Question

Several guys in our office have accounts on local linux(ubuntu) workstation (named local-server). But Just I have the account to access the remote samba server (named remote-server).

For security, I can not tell other guys my account and password information. But I want to share my mount point for them. For example, I mount remote samba server on this path: /home/samba/. I want everyone on local-server can read/write '/home/samba' directory and its sub-directory. (However, I don't want to modify the remote file's permission mode)

How can I configure it? Thank you very much!

Was it helpful?

Solution

You can set the uid/gid to be different and therefore allow other users to read/write to your share. First create a local group, e.g. shareaccess and assign it to your users:

sudo addgroup shareaccess
sudo usermod -a -G shareaccess user1

Then mount the share:

mount.cifs -ouid=youruser,forceuid,gid=shareaccess,forcegid,file_mode=770,dir_mode=770,credentials=/etc/secret-cred //server/share /home/samba

Files and directory will appear to be owned by youruser:shareaccess locally with permissions ug=rwx.

If the server is a Samba (not Windows) server too and has Unix extensions enabled, file and directory permissions are set according to the server. This might or might not be desirable. You can disable Unix extensions for the mount by adding the nounix option, which will force the modes to be the ones specified at mount-time. Be aware that this will disable all Unix extensions, e.g. symlink support.

References:

OTHER TIPS

if you want to re-attach your mounted samba network shares, you can use the following:

sudo mount -a

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top