Super Used (su) Command
The su command, also referred to as super user or set user or switch user. This allows a computer operator to change the current user account associated with the running virtual console. By default, and without any other command line argument, this will elevate the current user to the superuser of the local system.
When run from the command line, su asks for the target user's password, and if authenticated, grants the operator access to that account and the files and directories that account is permitted to access.
user1@localhost:~$ su
Password:
root@localhost:/home/user1# exit
logout
user1@localhost:~$
Additionally, one can switch to another user who is not the superuser; e.g. su user2.
user1@localhost:~$ su user2
Password:
user2@localhost:/home/user1$ exit
logout
user1@localhost:~$
It should generally be used with a hyphen by administrators (su -, which is identical to su - root), which can be used to start a login shell. This way users can assume the user environment of the target user:
user1@localhost:~$ su - user2
Password:
user2@localhost:~$
Please note that you have to use "-" so that user2 home will be selected when password is given.
No comments:
Post a Comment