Ubuntu

How do I Exit sudo Mode in Ubuntu 22.04?

How do I Exit sudo Mode in Ubuntu

Sudo means “Super User Do” and it allows users to have root privileges. With Sudo, a user gets complete access to access files, edit files, and delete files as well. Sudo allows specific users to get administrative-level access. Sudo should only be used when required as it gives users more power over the system which may lead to security concerns and thus should be utilized with caution.

This article explains the methods to exit sudo mode in Ubuntu.

How do I Exit sudo Mode in Ubuntu?

The sudo mode can be exited in the Ubuntu Terminal using a shortcut or several different methods. All the methods are mentioned below:

Method 1: Exit sudo Mode Using the “exit” Command

The sudo mode can be exited from Terminal Simply using the “exit” command. The snippet below shows the user is in the Root mode meaning the user has the sudo privileges:

The “exit” command will make the sudo user a normal user by logging him out. The “exit” command can be used as:

exit

Method 2: Exit sudo Mode Using the Shortcut Key

Apart from using the command statement, the terminal also supports shortcut keys and one of them can be used to exit from the Sudo Mode Using the “ctrl+D” keys:

Once used, the sudo mode is logged out:

Method 3: Exit sudo Mode Using the “logout” Command

Using the “logout” command also makes the sudo user a normal user by logging him out. The “logout” command can be executed as:

logout

Method 4: Exit sudo Mode Closing the Terminal Window

The sudo mode automatically closes once the terminal closes. By default, the normal user command line appears in the terminal.

Closing the terminal will log out the sudo user. Re-opening the terminal using either the shortcut key “ctril+alt+T” or opening from the GUI will confirm that the normal user mode appears:

Bonus Tip: Logging in as a Sudo User

If you want to log in again as a sudo user, you can use the command:

sudo -i

The Command Line will ask for authentication:

Enter the sudo user password to authenticate. Once Done, you will see the root statement mentioning you logged in as a sudo user:

Conclusion

Logging out or exiting from the Sudo Mode in Ubuntu is an easy process. With the “exit”, “logout” or “ctrl+D” shortcut key, a sudo user can easily log out and be a normal user of the system. This article has explained several methods to log out/exit sudo mode.

Similar Posts