10

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

20

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.

2
  • Quick question: Does SAMBA require FUSE, as sshfs does?
    – earthmeLon
    Sep 8, 2015 at 20:55
  • @earthmeLon No, Samba doesn't require FUSE. Sep 8, 2015 at 22:57

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.