在 Raspbian Jessie 上将 NTFS 驱动器或文件夹挂载为 Samba 共享

在 Raspbian Jessie 上将 NTFS 驱动器或文件夹挂载为 Samba 共享

我正在与 Raspbian Jessie 一起开发 Raspberry Pi B+。据我所知,驱动器以读/写方式安装,但我的 Samba 共享指向其上的安装点或文件夹时存在某种问题,因为当我尝试从 Windows 7 Pro 访问共享时64位机,看不到分享内容。我可以看到共享,并且可以尝试进行身份验证,但我不确定身份验证是否有效。

我记得在 Raspbian Wheezy 上执行此操作时遇到问题,我认为最终我必须在 fstab 文件中使用 UUID 并在那里设置一些权限或其他内容。由于出于其他原因我需要对这个 pi 进行大量工作,因此我升级到了 Jessie。我找不到我之前问过这个问题的帖子或问题,所以肯定是通过聊天或亲自询问的。

我更多的是 Windows 用户,对 Linux 的经验很少。其中大部分都激怒了 Stack Exchange 上的人们,我正在尝试遵循我在其他地方找到的说明。

我尝试连接的机器的 Samba 日志文件显示:

  STATUS=daemon 'smbd' finished starting up and ready to serve connectionsprocess_usershare_file: stat of /var/lib/samba/usershares/rootshar failed. Permission denied
[2016/02/08 18:56:49.771190,  0] ../source3/param/loadparm.c:4366(process_usershare_file)
  process_usershare_file: stat of /var/lib/samba/usershares/rootshar failed. No such file or directory
[2016/02/08 18:56:49.775938,  0] ../source3/param/loadparm.c:4366(process_usershare_file)
  process_usershare_file: stat of /var/lib/samba/usershares/rootshar failed. No such file or directory
[2016/02/08 18:56:50.769876,  0] ../source3/param/loadparm.c:4366(process_usershare_file)
  process_usershare_file: stat of /var/lib/samba/usershares/rootshar failed. Permission denied
[2016/02/08 18:56:50.774827,  0] ../source3/param/loadparm.c:4366(process_usershare_file)
  process_usershare_file: stat of /var/lib/samba/usershares/rootshar failed. No such file or directory
[2016/02/08 18:56:50.782438,  0] ../source3/param/loadparm.c:4366(process_usershare_file)
  process_usershare_file: stat of /var/lib/samba/usershares/rootshar failed. No such file or directory

您会注意到时间戳是几个小时前的。日志文件中没有更新的条目。

fstab 文件:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
/dev/sda1       /media/5TBDrive auto    noatime           0       0

# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

$ sudo 挂载

/dev/mmcblk0p2 on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=218244k,nr_inodes=54561,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sda1 on /media/5TBDrive type fuseblk (rw,noatime,user_id=0,group_id=0,allow_other,blksize=4096)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=44504k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

$ lsusb

Bus 001 Device 004: ID 04f2:0963 Chicony Electronics Co., Ltd
Bus 001 Device 005: ID 0bc2:3312 Seagate RSS LLC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

smb配置文件

[global]
   workgroup = WORKGROUP
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
   usershare allow guests = yes
[homes]
   comment = Home Directories
   browseable = yes
   read only = yes
   create mask = 0700
   directory mask = 0700
   valid users = %S
[RootShare]
   comment = Root Share
   path = /media/5TBDrive
   #valid users = @users
   #force group = users
   #create mask = 0660
   #directory mask = 0771
   read only = no

答案1

我不知道有一种方法可以测试 samba 配置。有,并且它包含在 Raspbian Jessie 中。它称为 testparm,是 samba-tool 的一部分。

samba-tool testparm

运行此命令告诉我,我的配置无效,并且我使用的主机名无效。就我而言,1 个字符太长了。覆盖名称并netbios name =完全修复系统。我怀疑samba服务器无法正常工作,名称错误。

在修复名称之前,我通过添加来升级日志记录级别log level = 3,据我所知,看起来所有用户都被忽略或解释为来宾用户。

相关内容