How to change an Ubuntu user

The Ubuntu operating system is designed to be used on behalf of one specific user. It is not necessary to change the user in the course of work so often. You usually enter your username and password when you log in, and then use it until it’s time to turn off the computer.

If you need to perform any actions with administrative privileges, then there is sudo for this. However, sometimes you need to change the Ubuntu user. In this article, we will talk about how to do this in the GUI and in the terminal.

How to change a user in Ubuntu

First, click on the shutdown icon in the upper-right corner of the screen and select End session orChange User:

Then confirm the end of the session or the shift:

Next, you will see the usual login window, where you can select a user from the list or enter their username in the input field. You will then find yourself back on the Ubuntu desktop.

Now let’s talk about how the user change is performed in the terminal. To do this, use the su command. For example, to change the user to losst, just run:

su losst

The utility will ask for the password of the user losst and then open a command prompt on his behalf:

If you want the path to the home folder and all other environment variables for the user to be updated, use the-l or –login option. Instead, you can also simply add a dash “-“. For example:

su - losst

If you run the utility without parameters, you will be logged in as the root user. But since the root password is not set by default, you should add sudo before it:

sudo su - 

In this case, sometimes it is better to use the-i option of the sudo command:

sudo -i

In this article, we looked at how to change the user in Ubuntu, as you can see, everything is very simple here. If you still have questions, ask in the comments!


(Visited 48 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *