Since I've upgraded my server from Debian 8 to 9 I have a strange behavior with bash. When I log in via ssh, none of the profile files are loaded, I get the following prompt:
Linux myserver 4.9.0-7-amd64 #1 SMP Debian 4.9.110-1 (2018-07-05) x86_64 Last login: Mon Jul 16 22:37:12 2018 from x.x.x.x -bash-4.4$
echo $0 returns -bash. I've put an
echo "sourcing ..." line into /etc/profile, ~/.bashrc to see when they are invoked, but none of these lines are displayed. However, if I source these files manually, the text is displayed and the file is sourced as it should.
Using strace (found here) to see which files were open I see that all of the profiles files were open.
echo exit | strace bash -li |& less | grep '^open'
I get the following output:
... open("/etc/profile", O_RDONLY) = 3 open("/etc/bash.bashrc", O_RDONLY) = 3 open("/etc/profile.d/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 open("/etc/profile.d/bash_completion.sh", O_RDONLY) = 3 ... open("/home/myuser/.bash_profile", O_RDONLY) = 3 open("/home/myuser/.bash_history", O_RDONLY) = 3 open("/home/myuser/.bash_history", O_RDONLY) = 3 ... open("/home/myuser/.bash_logout", O_RDONLY) = 3 open("/etc/bash.bash_logout", O_RDONLY) = -1 ENOENT (No such file or directory) ...
The problem only occurs when I log in as a normal user, once I su to root, the profile files are loaded as they should. I suspect that maybe only root has now permission to invoke the files, but I am going crazy as everything I checked is as it should be.
Any hint or idea is very much appreciated.
echo $SHELLreport? Does your SSH configuration include
ForceCommands for your user?