Thursday, September 1, 2022

[SOLVED] su - username command doesn't act as expected

Issue

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.



Answered By - sweintritt
Answer Checked By - Mary Flores (WPSolving Volunteer)