I have a remote sshfs filesystem mounted on /mnt/data
. Following is the relevant line in /etc/fstab
:
www-data@192.168.1.10:/var/www/ /mnt/data fuse.sshfs rw,noauto,nodev,nosuid,noexec,_netdev,allow_other,default_permissions,uid=martin,gid=martin 0 0
The files in /var/www/
on the remote system are owned by user www-data
, but I am using uid=martin,gid=martin
to map the ownership on the mounted filesystem to uid 1000.
When I cd to /mnt/data/
as martin, I have the correct file permissions/ownership, but I need to change the umask.
On the remote filesytem, the user www-data
has umask 0027
. On my local filesystem, the user martin
has umask 0077
. I want to keep the umask 0077
on my local files, but use 0027
on the sshfs mounted files (ie all files in /mnt/data/).
Is this even possible ?
I have tried setting acl permissions on the whole directory on the remote filesystem:
setfacl -d -m g::rx /var/www/
setfacl -d -m o::--- /var/www/
but this has no effect on the sshfs mounted share.
Best Answer
sshfs
is usingsftp
under the hood and theumask
for creation new files is handled by the remotesftp-server
. You can setumask
as an argument to thesftp-server
in/etc/ssh/sshd_config
on the server, such asor
or
The umask settings and extended ACL are not transferred through the SFTP protocol as implemented by openssh. Also note that there is no "
umask
on files", butumask
is always associated with running process creating the files.