linuxcommand-lineredhatsu

su - username command doesn't act as expected


I am trying to switch to another user using su command, but it doesn't work as expected.

What I am expecting:

[root@ubuntu ~]# su testuser
[testuser@ubuntu root]#

What actually happens:

[root@ubuntu ~]# su testuser
bash-4.2$

whoami command:

bash-4.2$ whoami
testuser

Solution

  • The testuser might not have the same bash configuration. So the prompt might look different. Check the current user with whoami after you switched the user.