We need instructions for setting the default file attributes for transferred files
asked Dec 29 '10 at 20:04
SSH KB ♦
The default file attributes for created files are defined in the shell initialisation files with umask on the server side. The definitions need to be made in a shell initialization file that is read even in a non-interactive login. Note that scp2 and sftp2 always use the shell on the remote side non-interactively. The correct initialization file and the location varies depending on the shell used on the server-side.
For example, when using zsh, the umask definition should be added to either /etc/zshenv or $HOME/.zshenv files because they are read on every invocation of the shell. Note that zsh /etc/zshrc is read only for interactive shells and thus in this case is not useful.
When using bash shell, you have to set BASH_ENV in /etc/environment to point to file where umask is set:
-- /etc/environment BASH_ENV=$HOME/.profile
You can also use the environment or login file alone:
The ssh-servant-g3 process will open and read the /etc/environment, /etc/default/login and /home/user/.ssh2/environment files if they exist.