Samba (Cannot Write) issue

偶尔善良 提交于 2021-02-08 06:33:29

问题


I have setup Samba between two linux boxes (Ubuntu Desktop 12.10 and Ubuntu Server 12.04). For some reason I cannot write to my samba share. To me it looks like I have the correct permissions. Below is my smb.conf, the filesystem permissions, and the steps I followed. I definitely have it misconfigured but I cannot find out how. Any help would be appreciated. Craig

  1. Created a user in ubuntu server (craig)
  2. Created a user and password in samba "smbuseradd -a craig" set the password
  3. Mounted the samba share from linux desktop. This seemed to mount just fine
  4. Attempted to write a file and it says that I don't have write permissions

Permissions on the server when viewed from the server "drwxrwxrwx 4 Craig Craig" Permissions when viewed from ubuntu desktop "drwxr-xr-x 0 root root"

[global]
follow symlinks = yes
wide links = yes
unix extensions = no

workgroup = Ubuntu Precise
security = user

unix password sync = yes

[homes]
comment = Home Directories
browseable = yes
writable=yes
create mask = 0777
directory mask = 0777
guest ok = yes

[share]
comment = Precise File Server
path = /home/craig
browsable = yes
guest ok = yes
read only = no
writable = yes
create mask = 0777
directory mask = 0777

EDIT: If I open my samba share as root then I can write to the folders. I tried doing a chmod and chgrp but that didn't seem to have any impact. I would prefer not to have to browse/write as root :)


回答1:


Ok, figured it out. It wasn't in my samba settings. The error was actually in how I was "permanently" mounting my samba share.

I was doing:

//192.168.1.11/craig /home/craig/musicServer cifs username=craig,password=MYPASSWORD 0 0

but I needed

//192.168.1.11/craig /home/craig/musicServer cifs username=craig,password=MYPASSWORD,file_mode=0777,dir_mode=0777 0 0 

Adding both file_mode and dir_mode solved it.




回答2:


The difference in owner printout is probably due to different UID/GID you have on your local and remote machines.

You can use noperm option at mount instead (no need for file_mode or dir_mode). This option turns off the local file permission check (so UID/GID inconsistency will be okay) and assume the remote identity you authenticated at mount. Remote access control is still enforced.



来源:https://stackoverflow.com/questions/13631510/samba-cannot-write-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!