Sshfs mount and file permissions on server

Hello,

I have a file server running latest ubuntu LTS (VERSION=“22.04.3 LTS (Jammy Jellyfish)”

I mount the server disk from two client machines, one running Ubuntu 22.04 and the other running Fedora 40. Both fuse installations are plain vanilla.

If I check the files permissions on the server when I transfer files from the clients, I observe the following

From Ubuntu: -rw-rw-r–+
From Fedora: -rw-r–r–+

Transferred files are plain txt files created with touch

Has anyone encountered the same problem?

Ubuntu and Fedora sets different umask for the sshd daemon. On Fedora you have umask = 022 meaning it removes write permission for group and others. Ubuntu you have umask = 002 meaning it removes write permission for others only.

The client has no say whatsoever what file permissions gets set.

3 Likes

Ok, but is there a solution so that when I transfer files from Fedora client to Ubuntu server the permissions are

-rw-rw-r–+

This is my goal

Added gnome, gvfs, nautilus, sshfs, workstation and removed server

That is an Ubuntu question, but it basically involves how to set the umask for users.

1 Like

I do not understand. This must be a recurrent problem because files on file servers are often used by groups which need a “w” permission.

I hoped that fuse/sftp/sshfs on fedora client could be setup so that the files you transfer to the file server are “g+w”. This works from ubuntu clients.

If this is not possible, seems to me that makes Fedora little usable.

sudo sed -i -r -e "s/^(UMASK\s+).*$/\1002/" /etc/login.defs

login.defs: shadow password suite configuration | shadow-utils File Formats | Man Pages | ManKier

1 Like

Thanks a lot, works fine!

1 Like

Just to develop a little further:

login.defs is executed at terminal login

To set correct UMASK by shell, u need to add “umask 002” to /etc/bashrc

bashrc is executed at session login.

Dolphin (KDE) does not set 002 umask unless you add:

“session optional pam_umask.so usergroups” to the /etc/pam.d/system-auth file

reboot and login again.

Not sure this is the most correct solution