I’m managing a CentOS 4.7 server with several for security reasons shell-less user accounts. But sometimes I need a user-shell for installations anyway. What is the best way to get a login shell? Just now I use
sudo –u <user> bash –rcfile /home/<user>/.bash_profile
But this is not perfect. A lot of the environment variables are not intitialized.
Erich
Try:
The sudo argument "-H" will set the home directory properly, and the "-l" option to bash will indicate that this is a login shell. You might also experiment with adding the bash argument "-p".