Obtain administrator privileges related commands
Article Directory
learning target
- To know the command to switch to the administrator user
Use 1. sudo command
command | Explanation |
---|---|
sudo -s | Switch to the root user, obtain administrator privileges |
sudo | Execute a command needs to obtain administrator privileges can add the sudo command executed on the front |
sudo -s renderings:
FIG sudo command Effect:
Description:
- If only a particular action requires administrator privileges is recommended to use sudo, that is to say the use of temporary manager privileges.
- If a large number of operations require administrator privileges sudo -s, but the operation need to be cautious.
Use 2. whoami command
command | Explanation |
---|---|
whoami | View the current user limit |
whoami command renderings:
Use 3. exit command
command | Explanation |
---|---|
exit | Log Users |
FIG exit command effects:
Description:
- If the user is landing after switching on the exit returns a login account.
- If a terminal interface to exit the current terminal.
4. who use the command
command | Explanation |
---|---|
who | See all logged-on user |
FIG effect who command:
5. passwd command using
command | Explanation |
---|---|
passwd | Change the user password, the user does not specify a default password to modify the currently logged on user |
FIG effect passwd command:
6. which use the command
command | Explanation |
---|---|
which | View command position |
FIG effect which command:
7. Use shutdown and restart commands
command | Explanation |
---|---|
shutdown –h now | Immediately shut down |
reboot | Restart |
8. Summary
- sudo get a temporary administrator rights
- sudo -s is to switch to the administrator user has administrator privileges, you need to exercise caution.
- exit is to exit the current user
- passwd change the current default user password