2

i mounted a folder from windows to Linux's like so

in windows end the permission is set to everyone enter image description here

and on my linux end i did this

# mount -t cifs -o username=sprite//173.11.111.99/win-share /mnt
Password for sprite@//173.11.111.99/win-share:  ************
# ls -ld
drwxr-xr-x. 2 root root 0 Sep  2 15:27 .
#

i have another user named coke which i want to have read/write/execute permission to how can i go about doing this

kunz
  • 123
  • 1
  • 6

1 Answers1

2

You need to define the wanted user id and group id in the mount command. Add uid and gid-parameters to the options. You can look up your user's values with the id command.

Example set of parameters: uid=1000,gid=1000,username=sprite

Provided your user and group id were 1000.

For the another user to access, put the users in the same group, such as users, then use that group's id in the mount command's gid-parameter. In this case I believe you also need additional parameter for the group to be able to write on the share, in which case you need the additional parameters dir_mode=0770,file_mode=0770

  • `# mount -t cifs -o uid=1000,gid=1000,username=sprite//173.11.111.99/win-share /mnt` is it suppose to be like this ? – kunz Sep 02 '21 at 07:36
  • Looks about right, save the missing space between your username and the server path. I tested with following command: `mount -t cifs -o uid=1000,gid=100,dir_mode=0770,file_mode=0770,username=myusername //192.168.0.10/demo /mnt/demo` – Ari 'APz' Sovijärvi Sep 02 '21 at 07:42
  • Why is both a uid and username parameter necessary? – Jarle Hammen Knudsen Nov 15 '22 at 21:24
  • @JarleHammenKnudsen uid and gid are used by Linux and that's the user ID and group given to all files on the Linux side. Username again is the user name offered to the other computer as a login credential. – Ari 'APz' Sovijärvi Nov 16 '22 at 22:04