3

I am facing the problem with permission on cifs shares. I have a Lubuntu netbook, a Win7 notebook and a QNAP NAS.

I mounted shares on the lubuntu netbook in the fstab:

//192.168.2.49/nasdata /home/NASDATA cifs username=nilli,password=xxx 0 0
//192.168.2.21/Users /home/WIN7 cifs username=nilli,password=yyy 0 0

If I try to write as a user on these shares I get an error that it is not permitted. If I mount the 'Public' folders on the QNAP NAS or the WIN7 notebook and try to write as root, it works.

Now I want to write as a normal user ( not as root ) and not in the 'Public'-folders, but in any normal folder, what do I have to do ?

Thanks a lot for the help !!!

andrew.46
  • 38,003
  • 27
  • 156
  • 232
nilli
  • 31

1 Answers1

3

You'll have to setup an effective user and or effective group as part of you mount options. Make sure the user or group has the type of access you want to provide for for that share.

You can also specify the type of file mask you want to be associated with the files and folders that user creates.

This is an example to add to your options:

uid=[username/ID],gid=[groupname/ID),file_mode=0660,dir_mode=0775

So you would effectively have:

//192.168.2.49/nasdata /home/NASDATA cifs username=nilli,password=xxx,uid=[username/ID],gid=[groupname/ID),file_mode=0660,dir_mode=0775 0 0

Change the bracket [entry] to either the desired username/groupname or uid/gid.

L. D. James
  • 25,036
  • Yes, thanks ! That works on the NAS. But unfortunately not on Win7 ... – nilli Jan 28 '16 at 18:49
  • @nilli Add rw to the options. An example is included to the update of my answer. I may have to setup a windows machine for additional test if you continue to have the same problem. – L. D. James Jan 28 '16 at 23:09
  • @James : Ok, my trouble were the premissions on th win7 machine. Now it works perfekt. Thanks a lot !! – nilli Jan 30 '16 at 08:55
  • Adding only rw was not sufficient and I needed to add as well the uid, gid, file mode and dir mode to mount it with read and write permissions. – ranu Oct 01 '19 at 20:41