Switch User
su(Switch User) command allows us to switch/change between one user to another. Just imagine that you are logged in a normal account, but while doing your work, you met a situation, where you need to log in to another account. In a situation like this, we can use su command.
"The whoami command tells the currently logged in user name."
Currently, we are logged in as the user root, and we are going to change the privilege from root user to a user called redhat.
For that you just type as given below.
su(Switch User) command allows us to switch/change between one user to another. Just imagine that you are logged in a normal account, but while doing your work, you met a situation, where you need to log in to another account. In a situation like this, we can use su command.
"The whoami command tells the currently logged in user name."
Currently, we are logged in as the user root, and we are going to change the privilege from root user to a user called redhat.
For that you just type as given below.
Exiting From the Switched account.
When you switch an account from root to someone, then the operating system will not ask for the password. But if you are trying to switch from a normal account(other than root) to any other account, your operating system will ask for the password of the account that you are going to switch to.
Switching from redhat to centos
Switching from redhat to centos
The default user name of su command is root
If you are going to switch from a normal account to root then you do not need to specify the user name root , you can do it in the following way.
Switching from redhat to root
If you are going to switch from a normal account to root then you do not need to specify the user name root , you can do it in the following way.
Switching from redhat to root