SSH new file/directory group write permission different than FTP etc

0

I am a non-root user on our Linux (Debian) install, and the file/folder permissions on the existing files in my home folder are -rw-rw-r-- and drwxrwxr-x for directories, and if I log into SSH directly (I use putty on Windows 7), then create a new file or folder, it creates it with those permissions. However, if I log in any other way, such as with FTP or SFTP or with my file editor (like Eclipse or Sublime Text) or with anything else, like win-sshfs, any file or folder I create doesn't have group write permission.

I've already added umask 002 to my .bash_profile, logged out of everything and back in, but no dice.

Dave Netz

Posted 2015-01-13T00:53:58.680

Reputation: 3

Answers

3

This behavior is FTP-/SFTP-server specific. You did not specify what server you are using.

For SFTP, I'm assuming OpenSSH, as that's used by a majority of distributions. For FTP, I'm making no guesses.


The OpenSSH SFTP server does not follow an umask you set in .bash_profile. Instead it uses it's own umask setting. It's a global setting by default. While it can be set per user, it can be set by a root only (it's configured in the sshd_config).

For more details see SFTP-server uploaded files having wrong rights.


An alternative solution (as also suggested in the link above), is to use an SFTP client that allows specifying permissions for uploaded files.

For example WinSCP allows that.

See https://winscp.net/eng/docs/ui_transfer_custom

Setting permissions for uploaded files in WinSCP

(I'm the author of WinSCP)

Martin Prikryl

Posted 2015-01-13T00:53:58.680

Reputation: 13 764

We're using Debian but they just don't have the group write permissions masked properly through SFTP, and FileZilla doesn't let me set a mask, so I'll just use WinSCP. – Dave Netz – 2015-01-21T21:31:18.747