![]() In the above syntax, the specifies which command you need to execute as a different user and the to pair along with the command. Before that, let’s see the syntax for the sudo command: But, with a small trick, you can use the sudo command to switch users in Linux. This command is generally used to execute various commands as a root or super user. The sudo command stands for “Super User Do”. How to Switch User in Linux using sudo Command To switch to regular users using the su command in Linux, use the following syntax: Start the shell as a login shell with an environment similar to a real login When used, creates a new pseudo-terminal for the session which is not shared with the original session for better security To specify a different shell instead of the default /bin/sh. I am going to use 'senthil' as current user and 'kumar' as the target user. For the purpose of this guide, I have created two user accounts namely 'senthil' and 'kumar' in my AlmaLinux 8 test machine. To pass a command to the new shell of the switched user. However, there is a simple way to run commands as another user via sudo in Linux. Some of the common options to pair with the su command are: In the above syntax, replace with the name of the user account you want to switch over to. The syntax to switch users using the su command in the Linux Terminal is: The su command, which stands for switch user, is a powerful tool to switch from one user account to another. ![]() How to Switch User in Linux using su Command Root User (Super User/ Administrator): These types of user accounts have complete unrestricted access to the entire file system with the highest level of security clearance.However, they can use su or sudo commands to gain administrative rights. Regular User: These types of user accounts have limited access to the file system according to their file permissions. ![]() To learn more about non-login users, do check out our article on how to create a non-login user in Linux. ![]() They are commonly used to run certain services or applications.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |