A shell or a command-line interpretation produces a user interface for a particular operating system. There are primarily two kinds of shells, like Unix or Linux shells.
In this article, we will discuss the different types of accounts in a Linux shell and how to switch amongst them using the ‘su’ command.
Contents
Different types of accounts
The Linux system can be operated by three kinds of accounts: a root account, a system account, and a user account. These usually come in the rank of privileges provided with the user account at the end of the line.
Logging into a user account is the simplest of the three where all you have to know is your username and password. It is almost the same for a system account, except these accounts receive a little more benefits than the common user accounts.
The ones with the root accounts are considered no lesser than omnipotent; they can operate anything anywhere and anytime. Of course, they must be conversant with the Linux root account lingo.
It is possible to switch accounts in a Linux shell only if you have another registered account in the shell. If that account allows user logins, you can change users using the ‘su’ command. It is a long term for the super user, switch user, or substitute user.
Switching users with the ‘su’ command
To alternate user using the ‘su’ command, follow the ensuing steps:
- Type “su -” followed by space and the username of the target user.
- Write the password of the mentioned user.
While carrying out the procedure, if you forget to add the hyphen, then you might notice changes that would differentiate this session from the regular one.
If you wish to revert to the previous session type ‘exit’ and then press the enter button.
Logging in with the root account
Like we’ve already mentioned earlier, the ones with the root account are no less than omnipotent. They have the power to erase or create a file from the server at any point in time. Therefore, while one logs in to the root account, the Linux system ensures that they are not a hacker by requiring them to initiate the root session from another user session with the help of the ‘su’ command.
Security risks that are involved with the ‘su’ command
The security policies that the Linux systems practices are slightly different from any other interface. For example, if one wishes to switch users with the help of a ‘su’ command, they need to know the password for the separate account. While it is not a problem for a person who has two or more accounts registered to their name, this is a massive concern for professional accounts.