Logon On As Different User In Linux In Same Terminal Window [Quick Tip]

I have been using Linux for quite some time and have been using flavors such as Red Hat, Fedora, Solaris and Ubuntu so thought it as a good option to give useful tips to my readers who are trying to learn Linux or have been using it for some time.

The first tip I wanted to talk was about quickly changing users on Linux without having to logout while you are using bash or any other command line interface.

Once you have logged into a terminal the owner of the terminal is the user you logged on with and if you wish to logon as another user there is no need to actually open another terminal window.

The su command

The su command allows users to directly login as root, but it can be used for other purposes too part of which we will talk in this post.

Changing users quickly in same terminal

Using the su command we can quickly change users in a bash terminal for that type the following command;

su – username

When you issue this command it says that change my user to the username I have provided, once you have issued this command you will be prompted for a password. The password you have to enter is not for the root user but for the username you have provided.

Once you are successfully authenticated your bash environment will change to the username you logged on with.

Want more such tips about topics I don’t cover, you can Linux Tips,Change users in linux,Bash