Score:0

How add group write permissions for a mounted shared directory? (client/server case)

kz flag

I have a MacOS with a shared directory. I am able to access in Ubuntu Linux with:

# From Linux to MacOS
sudo mount -t cifs //192.168.1.X/directory_shared
                   /mnt/192.168.1.X/directoryname
                   -o username=username,
                   rw,
                   uid=####,
                   gid=####,
                   nounix,sec=ntlmssp

The problem is that if I do ls -l in the client side the group always have r-x.

if I do in the server (macOS) sudo chmod -R g+w XXX it is not reflected in the client, and if in the client the sudo chmod -R g+w XXX command is executed it does not apply the new settings, therefore is ignored (it remains with r-x). I need the group write permissions in the mounted directory to write/edit any content created in the server.

Note: The username in the server and client are different - the owner can be alpha and in the client can be Beta, but Beta exists how a created user in the server too, it to let the connection from the client to server. So for security reason is not allowed do a connection from the client to the server based with the alpha type, just with Beta, and the owner of the files in the server is mostly Alpha (it is in a /Users/Shared location in Mac for any user). These users (server and client) share the same group name (a secondary group type). So, it does not matter by whom is created a new file/directory, they must let complete access to all users because the primary group of that files is the same assigned how the secondary group for these users.

How I can accomplish this goal? it either through the sudo mount -t cifs ... [options] or something missing through the chmod command.

Score:1
es flag

CIFS is a virtual filesystem that creates a "view" of the remote share with a set of permissions specific to the client - not the server. You cannot chown / chmod a virtual filesystem. And cifs has no visibility to permissions on the server.

By default a cifs mount will create a "view" that has owner = root ( unless you specify uid / gid as you have done ) and permissions of 755.

You can modify those permissions by using the dir_mode and file_mode parameters.

So for example if you want write access to the mounted share for everyone in the gid=#### group:

sudo mount -t cifs //192.168.1.X/directory_shared /mnt/192.168.1.X/directoryname -o username=username,rw,uid=####,gid=####,nounix,sec=ntlmssp,dir_mode=0775,file_mode=0664

Please note that this reflects what the client users see. The user specified by uid=#### and everyone who is a member of the gid=### group - on the client - will have write access to the mounted share.

However, The only user the server sees is the user specified by the credentials that were passed to it: username=username. If that user does not have write access to the actual folder being shared on the server no one will have access on the client. If he does have write access then he and any client user of the group will save files with owner = username on the server.

Manuel Jordan avatar
kz flag
Thanks, currently I use `dir_mode=0770,file_mode0770` mostly I am working through the group access control
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.