🌐 🇵🇱 Polski · 🇬🇧 EN
With a large number of accounts existing in the system, sooner or later you will encounter a permissions issue or another situation requiring you to switch to an account with higher privileges, or to log in to your own account on a user's terminal to demonstrate something, etc. The following commands come in handy:
- su - Switch to another user
- sudo - Execute a command with root privileges
For example, you are logged in as User02, and User03 next to you is having trouble executing a command. You can switch to the User03 account to check if something is actually not working, or if the problem lies with the user themselves.
We switch between users as follows:
# su user03
Password:
Enter the User03 password to log in to their account. Once finished, run the "exit" command to return to your own user. To switch to the root user account, perform it this way:
# su -
Password:
Enter the password and work as a superuser. If you do not want or need to work on the root account, but want to execute a single command with root privileges using another account, you can use the "sudo" option. For example, if you want to create a user account while logged in as a regular user:
# sudo useradd user09
To verify which type of user is currently logged in, you can look at the prompt, which will be "#" for the root user and "$" for regular users.
At this point, you are already an advanced expert in user account management. You can add, modify, and delete user accounts.
Comments