Ubuntu is designed to work under a single user account, so you don't have to change users in the system very often. To work it is enough to enter login and password, i.e. to pass authorization, and use the system until the work is finished. If administrative privileges are needed, sudo
is provided for this purpose. Nevertheless, there are still situations when you need to change the user in Ubuntu. In this article, we will talk about how to do this in the GUI and in the terminal.
Find the shutdown icon in the bottom right corner, click on it, select "End Session" or "Change User":
Now confirm to end the session or change:
Next, a standard login window will open, where you can select a user from the list or enter their login in the input field. The user will then be back on the Ubuntu desktop.
Let's talk about how the user change is performed in the terminal. To do this, you need to use the su command. For example, to change the user to losst it is enough to execute:
$ su losst
The program will ask for the password of the user losst after which it will open the command line on his behalf:
If you want the home folder path and all other environment variables for the user to be updated, use the -l
or --login
option. You can also just add a dash "-" instead. For example:
$ su - losst
You can run the utility without parameters, then you will log in as the root user. But since the root password is not set by default, you should add sudo
in front of it:
$ sudo su
Sometimes it is easier to use the -i
option of the sudo
command:
$ sudo -i
In this tutorial, we have covered how to change user in Ubuntu. Good luck!