I'm having trouble with permissions involving an SMB share hosted on another machine on my local network. It appears that no matter what options I provide in the /etc/fstab or in a mount command, ls -l always yields:

drwxr-xr-x

Here's the current /etc/fstab entry:

//this-is-my-server.local/share-folder    /mnt/smb    cifs    credentials=<some-cred-file>,uid=0,gid=100,file_mode=0775,dir_mode=0775    0    4

Here's the aforementioned (and redacted) credentials file:

username=myusername
password=mypassword

Here's the smb.conf share configuration on the hosting server:

[share]
   path = /some/path
   browseable = yes
   writeable = yes
   create mask = 0775
   directory mask = 0775

To clarify, I can mount the share just fine, but I cannot write or create any files without sudo on the Pi. Note that a Windows machine which has the drive mapped can write and create files just fine.

Am I missing something in my setup here? Or, are the directory and file permissions being overridden elsewhere?

Edit: Running Raspbian 8 on a RasberryPi 3.

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

Try adding to the mount options also "forceuid, forcegid". You therefore should have something like:

//this-is-my-server.local/share-folder    /mnt/smb    cifs    credentials=<some-cred-file>,uid=0,gid=100,file_mode=0775,dir_mode=0775,forceuid,forcegid    0    4

BTW, if I'm not wrong you should also use the full names for UID and GUID (i.e. "root" instead of "0" etc), but I'm not sure it makes any difference.

uid=0,gid=100,file_mode=0775,dir_mode=0775

With uid=0, you are explicitly telling your machine that every file should be owned by root.

With file_mode=0775, you are telling your machine that "everyone" else should only have read access, not write access.

For a single-user machine, it probably makes more sense to set your uid= option to be your user's uid, not root's uid. Either that, or set your file/dir modes to 777, granting write access to "everyone".

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.