2

ssh user@host "umask" gives 0174

ssh user@host and the umask from server shell gives 0002

Could you please explain how can it happen?

UPD: Actually, it was /etc/passwd overriding umask.

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47

1 Answers1

3

From the bash man page:

When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. (...) When invoked as an interactive login shell, or a non-interactive shell with the --login option, it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order.

In your first command (ssh user@host "umask") it is not a login shell, in the second case, it is. So check your ~/.bashrc file for a umask 0002 command.

Tommiie
  • 5,627
  • 2
  • 12
  • 46