我正在尝试在 Ubuntu 中挂载 Samba 共享文件夹,但我遇到了一些问题,因为挂载该文件夹时,我没有权限在已挂载的文件夹上写入。
首先,共享文件夹位于名为的服务器上vmfox
,文件夹名称为apps
。在 VMFox 服务器上,我有以下 Samba 配置/etc/samba/smb.conf
:
[global]
workgroup = MYDOMAINNAME
netbios name = vmfox
server string =
security = DOMAIN
encrypt passwords = true
obey pam restrictions = Yes
password server = server.mydomain.com.be
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *New*password* %n\n *Retype*new*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
unix password sync = Yes
log file = /var/log/samba/%m.log
max log size = 0
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = No
wins server = 201.232.023.10
kernel oplocks = No
NIS homedir = Yes
create mask = 0775
directory mask = 0775
printing = cups
oplocks = No
[apps]
path = /l/disk0/apps
valid users = myuser,otheruser
public = no
writable = yes
create mask = yes
force user = www-data
force group = www-data
因此,使用上述配置,我/etc/fstab
在本地计算机上编辑了文件以挂载共享文件夹。首先,我使用我的凭据创建了一个文件:~/.smbcredentials
内容如下:
username=myusername
password=mypassowrd
最后,文件/etc/fstab
包含以下行:
//vmfox.example.com/apps /home/rgiaviti/Dev/Network/vmfox cifs credentials=/home/rgiaviti/.smbcredentials,iocharset=utf8,domain=MYDOMAINDOMAIN,file_mode=0777,dir_mode=0777 0 0
好的。一切完成后,使用 挂载了共享文件夹sudo mount -a
。问题是,我没有挂载文件夹的写入权限。当我在 Windows 机器上访问此共享文件夹时,我可以正常写入此文件夹。
答案1
这个命令/etc/fstab
应该有帮助:
//server.domain.com/<shared_folder> /mnt/shared cifs uid=<username>,credentials=/home/<username>/.smbcredentials,iocharset=utf8,sec=ntlm,domain=AQUARIUS 0 0
在文件中/home/<username>/.smbcredentials
,使用以下格式:
username=<username without domain>
password=<password>