12

I mount a samba share with the following command:

# mount -t cifs //192.168.1.1/username pc -o username=username,password=xxxxx

But only root can go inside that share.

How to allow users read/write in the share?

1 Answer 1

23

If only one user needs read/write access, you can make them the owner of the mounted directory using the option uid=<linux_username>:

mount -t cifs //192.168.1.1/username pc -o uid=<unix_username>,username=username,password=xxxxx

If more than one user need read/write access, you can create a group, add the users to it:

addgroup new_group
adduser user1 new_group
adduser user2 new_group
adduser user3 new_group

then mount the share using options gid, file_mode and dir_mode:

mount -t cifs //192.168.1.1/username pc -o gid=new_group,file_mode=0664,dir_mode=0775,username=username,password=xxxxx

More information: mount.cifs manual page.

3
  • Quick question: Does SAMBA require FUSE, as sshfs does?
    – earthmeLon
    Commented Sep 8, 2015 at 20:55
  • @earthmeLon No, Samba doesn't require FUSE. Commented Sep 8, 2015 at 22:57
  • 1
    Thanks for going above and beyond with the group idea! I am using that for sure :)
    – ZaxLofful
    Commented Apr 25, 2023 at 21:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .