1

Im trying to setup a samba share. I want the share to have access rights rwxrwsrws so that everyone can red and write to it.

The folder shared on the server where the share resides is sat by chmod 777 to rwxrwsrws.

The folder on the client computer has also been sat by chmod 777 to rwxrwsrws, but as soon as I map that folder to the share the permissions are changed to rwxr x r x when I view it by ls -l and I can't write to the maped folder by using a user that's different from the owner.

Here's what I have done so far:

  1. Installed samba on a server
  2. Sat 777 on the folder /data by chmod 777 and shared it by samba
  3. On the client computer sat 777 on a folder /data (by chmod 777)
  4. Mapped this folder to the share on the server

This is how I have configured the samba share:

[global]

security = user

unix extensions = no

map to guest = Bad User

public = yes

guest account = nobody


[public]

path = /disk2/data

guest ok = yes

writable = yes

browsable = yes

public = yes

directory mask = 0777

directory security mask = 0777

force directory mode = 0777

force directory security mode = 0777

hide dot files = no

This is how I have mapped the folder to the share on the client computer:

Sudo mount –t cifs //xx.xx.xx.xx/public /data –o user=nobody
0

The directory that you have created and shared via SAMBA in the server is rwxrwsrws and the directory you have created in Client is rwxrwsrws.

But once you have mounted the share via sudo, that directory will become rwxr x r x

So ultimately you need to mount the samba share and then change the directory permission.

# chmod -R 777 /data/

Never mount network files as Root user.

mount –t cifs //xx.xx.xx.xx/public /data –o user=nobody

For permanent mount and auto permission change.

Add this in /etc/fstab

//xx.xx.xx.xx/public /data cifs username=nobody,network,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm

Note: Also keep in mind that cifs is supposed to be for user mounts not entire systems. It basically assumes you will be mounting 1 user on this side to 1 user on that side

  • Thanks Ruban, You solved my problem :) I had alredy tried to use chmod 777 after I had maped the folder to the share but it still could not change from rwx r x r x, also the chown -R root:root /data didn't change anything. What worked however was you line in /etc/fstab The one I had put in there myself and didn't Work was: //10.4.98.110/public /data cifs user=nobody 0 0 – Michael Jacobsen Feb 5 '16 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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