Menu
User

DropVPS Team

Writer: John hens

How to Switch User in Ubuntu 25.04 ?

How to Switch User in Ubuntu 25.04 ?

Publication Date

12/28/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Switching users in Ubuntu 25.04 is a common task for system administrators and multi-user environments. Ubuntu provides several simple and secure ways to change users, whether you are working from the desktop interface or the command line.

STEP 1: Switch User Using the Graphical Interface (GUI)

Using the graphical interface is the easiest and safest way to switch users in Ubuntu, especially for desktop users who prefer not to use terminal commands.

Top-Right Menu → Log Out / Switch User → Select User → Enter Password

STEP 2: Switch User Using the su Command

The su command allows you to switch to another user directly from the terminal.You will be prompted to enter the target user’s password. Once authenticated, you will be logged into that user’s shell.

su username

STEP 3: Switch User Using the sudo su Command 

This method is preferred for administrators because it uses sudo permissions instead of the target user’s password.The dash (-) loads the full environment of the target user, including paths and variables.

sudo su - username

STEP 4: Switch to the Root User

If you need full administrative access, you can switch to the root user (if enabled).Ubuntu disables direct root login by default, so this method is safer and recommended.

sudo su -

STEP 5: Switch User for a Single Command

If you only need to run one command as another user, this is the cleanest option.This avoids switching shells and improves security.

sudo -u username command

Example:

sudo -u john ls /home/john

STEP 6: Verify the Current User

After switching users, you can confirm the active user with the following command:This helps ensure you are operating under the correct account.

whoami

STEP 7: Common Issues and Fixes

Sometimes switching users may fail due to permission or configuration issues.

sudo usermod -aG sudo username

sudo usermod -aG sudo username:

cat /etc/passwd
Linux VPS
U
Loading...

Related Posts