Setting umask when default shell is not bash or ksh
We are running Solaris with OpenSSH and the default shell for our users is csh. We tell users to put an
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:
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 <ryangerry@yahoo.com> or post them here.
:P
exec /path/to/their/favorite/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
If you have any questions, feel free to contact me at <ryangerry@yahoo.com> or post them here.
:P