I mounted a network drive (Storage Server) to the directory /home/ldap
for all OpenLDAP client computers. If a user login one of the computers, their home directory will be set the mount point as: /home/ldap/users/{username}
. Users can read and write to their directory freely.
Now I have a tester account in OpenLDAP named tester4
under group users
and logged into one of the computers. After login, I run ls -al
to check the permissions.
Location: tester4@Computer1:/home/ldap/users/tester4
$ ls -al
drwxr-xr-x 1 tester4 users 4096 Aug 30 20:57 .
drwxr-xr-x 1 root usrstomgr 4096 Aug 30 18:17 ..
-rw-r--r-- 1 tester4 users 220 Aug 30 17:57 .bash_logout
-rw-r--r-- 1 tester4 users 3771 Aug 30 17:57 .bashrc
drwx------ 1 tester4 users 4096 Aug 30 17:57 .cache
-rw-r--r-- 1 tester4 users 655 Aug 30 17:57 .profile
I tried to create a directory in this directory but not successful. tester4
is the owner of the directory, why tester4
does not have the write permission?
Location: tester4@Computer1:/home/ldap/users/tester4
$ mkdir no
mkdir: cannot create directory ‘no’: Permission denied
Then, I directly use tester4
to login the storage server and create a directory.
Location: tester4@Storage:/home/ldap/users/tester4
$ mkdir no
$ ls -al
drwxr-xr-x 2 tester4 users 4096 Aug 30 23:02 no
What is the problem disallowing tester4
to write to the SSHFS mount point? The following is the commands (without sudo) I used to mount the network drive in Computer1, where casper
is the admin user of Computer1.
sshfs -o allow_other -o kernel_cache -o auto_cache -o cache=no -o reconnect -o compression=no -o cache_timeout=6000 -o ServerAliveInterval=15 casper@{Storage IP}:/home/ldap /home/ldap
Update
If I change the owner of .
directory to casper
, tester4
can write to the directory. If tester4
create a file, the owner of the file is casper
.
How can I configure SSHFS to allow other users to write to the directory using their identity?
ssfs
with a specific user, in your casecasper
, and all file creations/modifications/deletes will be executed on the storage server with the user ID which has initiated the mount. So you either should mount the user home for each user ( maybe possible with autofs ), or why not use NFS?root
to mount the network folder and all other users can access the content under the basic Linux permission rules?autofs
seems easier thanNFS
.sshfs
mount. And performance will be much better with NFS. Go for NFS.