Home Beginner's Guide How to easily switch User Accounts in Ubuntu

How to easily switch User Accounts in Ubuntu

Switching users in Ubuntu is a straightforward process. This guide provides detailed steps on how to change user accounts using both the graphical interface and command line, ensuring you can easily manage and switch between different users on your Ubuntu system.

by Arun Kumar
how to switch users quickly and easily

Navigating through different user accounts is a common requirement for many Ubuntu users, whether it’s for accessing specific files, managing different profiles, or performing administrative tasks. Understanding how to switch users efficiently and securely in Ubuntu is not just a fundamental skill but also crucial for maintaining the integrity and security of your system.

In this blog, we delve into various methods of user switching in Ubuntu, covering both graphical and command-line techniques. From the simplicity of GUI interactions to the more technical terminal commands, this guide aims to equip you with the necessary knowledge to seamlessly switch between users, enhancing your Ubuntu experience while keeping your system secure.

Understanding user switching in Ubuntu

Before diving into the how-to, it’s crucial to understand why you might need to switch users. In my experience, the most common reasons include accessing files or applications under another user, or performing tasks that require administrative privileges.

Using the graphical user interface (GUI)

The easiest way for beginners is through the GUI. Here’s how you do it:

  1. Click on the top-right corner of your screen: You’ll see a menu where your username is displayed.
  2. Select your username: A dropdown menu will appear.
  3. Choose ‘Switch User’: This will take you to the login screen.
    ubuntu switch users

    Switching Users in Ubuntu

  4. Select the user you want to switch to and enter their password.

This method is straightforward but requires that you leave your current session. Personally, I find it a bit disruptive, especially if I’m in the middle of something.

Using the terminal

Switching users through the terminal is my preferred method. It’s quick and doesn’t interrupt your current session.

Switching to another regular user

  1. Open a terminal window.
  2. Type su - [username] and press Enter.
  3. Enter the password for that user.

Here’s an example:

$ su - jane

Once you enter the correct password, you’ll be logged in as that user.

Switching to the root user

To switch to the root user, which is necessary for administrative tasks:

  1. Open a terminal window.
  2. Type sudo su and press Enter.
  3. Enter your password.


$ sudo su

Remember, with great power comes great responsibility. Be careful when logged in as the root user!

Returning to your original user

To return to your original user session, simply type exit and press Enter.


$ exit

Using the su command versus sudo -i or sudo -s

There’s a subtle difference between these commands:

  • su switches to another user and requires that user’s password.
  • sudo -i or sudo -s switches to root and requires your password, assuming your user is in the sudoers list.

I prefer sudo -i when performing administrative tasks because it doesn’t require the root password, which is often disabled by default in Ubuntu.

What about graphical applications?

If you need to run a graphical application as another user, use the gksu command. For instance, to open a text editor as another user, you would use:

gksu -u [username] gedit

However, be cautious with this, as running graphical applications as another user can sometimes lead to permission issues.

Frequently asked questions about switching users in Ubuntu

Can I switch users in Ubuntu without entering a password?

Generally, you need to enter the password of the user you’re switching to. This is a security measure. However, if you’re using sudo to switch to a root user and your user account is configured with sudo privileges, you’ll need your password, not the root password.

What happens to my current session when I switch users?

When you switch users via the GUI, your current session is locked. You can return to it by logging back in. In the terminal, your session remains active in the background, and you can return to it by typing exit.

Can I switch users in Ubuntu remotely?

Yes, you can switch users remotely if you’re accessing Ubuntu through SSH. The commands remain the same (su - [username]), but ensure you have the necessary permissions and secure your connections.

Is it safe to use the root account for regular tasks?

No, it’s not recommended to use the root account for regular tasks due to its unrestricted access to the system. Mistakes made as the root user can have serious consequences.

How can I find out who I am logged in as?

In the terminal, type whoami and press Enter. It will return the username of your current session. This is especially useful when you’ve switched between multiple users.

Can multiple users be logged in simultaneously in Ubuntu?

Yes, multiple users can be logged in at the same time. This is true for both GUI and terminal sessions. Each user’s session is independent of the others.

What is the difference between su and sudo commands?

su stands for ‘switch user’ and is used to switch to another user account. sudo stands for ‘superuser do’ and is used to run commands with superuser privileges. Essentially, sudo gives you the power of the root user for a single command, while su switches you to the root user (or another user) entirely.

I forgot a user’s password. How can I switch to that user?

If you’re an administrator with sudo privileges, you can reset the password using passwd [username]. However, if you don’t have such privileges, you’ll need to contact your system administrator.

Can I switch users in a script?

Yes, but it’s complex and potentially risky. Scripts that switch users need to handle passwords securely, which can be challenging. It’s generally better to design your scripts to not require user switching.

What’s the difference between logging out and switching users?

Logging out ends your session entirely, closing all open applications. Switching users simply locks your session, allowing you to return to it later without losing your work.


Switching users in Ubuntu is a versatile and essential feature that caters to a variety of needs, from accessing different user accounts to performing administrative tasks. Whether you prefer the straightforward approach of the GUI or the efficiency of the terminal, understanding how to switch users is crucial for effective system management.

While the process is generally user-friendly, it’s important to be mindful of the security implications, especially when dealing with administrative privileges or root access. This guide, along with the addressed FAQs, should serve as a comprehensive resource, helping both beginners and experienced users navigate user switching in Ubuntu with confidence and ease.

You may also like

Leave a Comment



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us


©2016-2023 FOSS LINUX



“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.