Samba 文件共享权限问题

Samba 文件共享权限问题

我有一个关于 Samba 共享的简短问题。我最近构建了一个 Ubuntu 服务器,并将我之前的所有 Windows NTFS HDD 移到了该服务器中。我的目标是共享所有 4 个 HDD 以在我的其他 Windows 机器上使用,并通过 Plex 媒体服务器共享。我已通过 Ubuntu 共享 HDD,但无法更改权限,即使尝试通过 smb.conf 手动配置,也无法成功更改权限。我已附上我在 smb.conf 中配置的内容。任何帮助都将不胜感激。以下是 smb.conf 的其余部分,供参考。

[global]

   workgroup = WORKGROUP
   server string = %h server (Samba, Ubuntu)
   wins support = yes
   dns proxy = no



   log file = /var/log/samba/log.%m
   max log size = 1000

   syslog = 0
   panic action = /usr/share/samba/panic-action %d


####### Authentication #######


  security = user
  encrypt passwords = true
  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


#======================= Share Definitions =======================

  realm = localdomain
  server role = domain controller
  server services = +smb -s3fs
  dcerpc endpoint servers = -winreg -srvsvc
[printers]
  comment = All Printers
  browseable = no
  path = /var/spool/samba
  printable = yes
  guest ok = no
  read only = yes
  create mask = 0700


[print$]
  comment = Printer Drivers
  path = /var/lib/samba/printers
  browseable = yes
  read only = yes
  guest ok = no


# Ross's Shares
[share]
    comment = home
    path = /home/roce/Downloads
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0777

[share]
    comment = SDB - Data
    path = /home/roce/Data
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0777

[share]
    comment = SDC - Movies
    path = /home/roce/Movies
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0777

[share]
    comment = SDD - TV Shows
    path = /home/roce/TV Shows
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0777

[share]
    comment = SDE
    path = /home/roce/Data
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0777

[sysvol]
  path = /var/lib/samba/sysvol
  read only = no

[netlogon]
  path = /var/lib/samba/sysvol/localdomain/scripts
  read only = no

答案1

您的文件系统权限也需要允许访问(系统 > samba)。对于 NTFS,权限由您挂载的方式决定。尝试:

sudo umount /所需/路径
sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0000,exec /dev/desired/path /mnt/desired/path

从 mount 手册页中可以看到:“默认情况下,文件归 root 所有,其他人无法读取。”您也可以尝试 ntfs3g:http://manpages.ubuntu.com/manpages/oneiric/man8/ntfs-3g.8.html#contenttoc,但最好的选择可能是使用权限选项修改你的 fstab:

sudo umount /所需/路径
命令 blkid
sudo gedit /etc/fstab

blkid 命令用于查找分区 UUID。在 fstab 中编辑条目如下:

    # 将“UUID”更改为您的分区 UUID
    UUID=12102C02102CEB83 /media/windows ntfs-3g auto,用户,权限 0 0

最后,创建一个挂载点并挂载外部硬盘:

sudo mkdir /media/windows
挂载/media/windows

“auto”选项会在您启动时自动挂载分区,“users”选项允许用户挂载和卸载。如果不是 NTFS 驱动器,您可以从终端尝试此操作:

sudo chmod -R 775 /所需/路径

致谢:如何在 NTFS(或 FAT32)分区上使用“chmod”?

相关内容