I have linux user lUser (uid=123) that is in the group lGroup (guid=145). I have windows user wUser that has full access to the share. I want to automount that share on linux machine and give lUser full access to that directory. I've edited /etc/fstab:

// /home/root/WinShare cifs username=wUser,password=Password,iocharset=utf8,sec=ntlm,uid=123,gid=145 0 0

I am doing sudo mount -a and this folder is still owned by root.

Then I created users on both machines with the same name and password. After that I added following line to the fstab

// /home/user/WinShare cifs iocharset=utf8,sec=ntlm,uid=1000,gid=1000 0 0

It is still mounted as root

I've also tried to do:

// /home/user/WinShare ntfs-3g users,permissions,auto 0 0

still the same ...

1 Answer 1


As per mount.cifs documentation, the uid and gid parameters only work when the server does not support UNIX extensions. The forceuid and forcegid parameters prevent this behavior. If you connect to a NAS, it might use Samba too.

You can also specify UID and GID by using the actual user/group name.

There’s also this Ubuntu bug, perhaps it’s still relevant.

  • I've created user with the same name and password on the both machines and then trying to add following line: // /home/user/WinShare cifs iocharset=utf8,sec=ntlm,uid=1000,gid=1000 0 0 and still it is mounted as root Oct 15, 2015 at 9:49
  • I've edited the question, added 1 more option I've tried Oct 15, 2015 at 10:06
  • I was able to change ownership from root to my current user, but not to the one I needed.... Oct 15, 2015 at 14:29
  • Again: Did you try forceuid? This is a yes/no question.
    – Daniel B
    Oct 15, 2015 at 17:22
  • yes. I was able to change ownership from root to my current user but not to the one I needed. Oct 15, 2015 at 18:21

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.