Topic "Setting umask when default shell is not bash or ksh"

Author Message

We are running Solaris with OpenSSH and the default shell for our users is csh. We tell users to put an
exec /path/to/their/favorite/shell

in thier .login file. This way, we can configure the environment in csh and don't have to worry about different shell config file formats while essentially allowing users to choose their own shell.

Anyway, WinSCP worked fine as long as users specified thbe path to bash in the WinSCP preferences. The problem occured when a new directory was created. The "create new directory" command always created a directory with the permissions of rwxrwxrwx (777). However, uploaded files, or directories were created with a umask of 022 (resulting in file or directory permissions of 644 or 755 rerspectivly). We identified the problem at login time. What happened is that since the process started out as csh, and then changed to bash, bash did not see itself as an interactive shell and did not read any config files (system or user) which would set its umask to 022.

The solution we came up with was to put the line: Idea
umask 022

in our init.d right before sshd is started. This way sshd's umask was 022 and any processes it spawned also had a umask of 022.

If you have any questions, feel free to contact me at <> or post them here.

Great tip!

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License