bashrc not loaded in /bin/bash shell
the ~/.bashrc
file is loaded for interactive non-login shells, that's why running /bin/bash
from ssh works as you expect.
For login shells (amongst others) ~/.bash_profile is read. Typically your ~/.bash_profile
contains something like
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Which ensures that ~/.bashrc
is loaded if your shell is a login shell.
If your ~/.bash_profile
contains the above and ~/.bashrc
is not being loaded you can debug the scripts by using set -x
as usual.
Normally when a user is created it will copy a bunch of files to your new homedirectory (if you chose to create one).
You can check the /etc/skel
directory for those files. There should be the .bash_profile
that you expected.
As none of the previous, it seemd that the user didn't have a shell assigned, so it just show the character $
as prompt.
I had to assign a shell to the user by running the command:
sudo usermod --shell /bin/bash username
After that, the user automatically logged in with a bash shell.