-   Linux - Server (
-   -   How to set file permissions using SFTP client (

thesignchef 04-27-2009 10:40 AM

How to set file permissions using SFTP client
I have created 3 users with all the same group. I want the umask to be 0002 so that new files are 0775. I edited /etc/profile so that umask for that group would be 0775. That works when SSHed into that account, although, using FileZilla and SFTP into the account sets files at 0755 by default still.

Please help.

Thank you.


anomie 04-27-2009 11:00 AM

AFAIK, sftp (in of itself) honors the user's umask. Are you sure your sftp client isn't doing some permission changes for you? Try sftp from the command line and see if it is behaving the way you would expect.

thesignchef 04-27-2009 11:23 AM

I just tried sftp using one of the accounts. It set the file to 0755. Again, I am trying to have it set to 0775. It can't be sshd, I don't think, because SSHing into the account and making a file is correct at 0775 like how I set it up in /etc/profile. Is it possible it is not reading /etc/profile when SFTPing into the account with FileZilla. I really don't think FileZilla is doing anything either.

Thank you

anomie 04-27-2009 12:00 PM

Hmm, a sftp login doesn't appear to read /etc/bashrc either (which makes sense, since it's the startup file for a particular interactive shell).

Read the manpages for sshd(8). A snippet follows:

When a user successfully logs in, sshd does the following:
6. Reads the file ~/.ssh/environment, if it exists, and users are
allowed to change their environment. See the
PermitUserEnvironment option in sshd_config(5).
8. If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists,
runs it...
You will likely need to work with that information.

All times are GMT -5. The time now is 06:49 AM.