su - sudo

su handover command to the user, substitute English meaning of "place" means

①su: without default user name is switched to root, cut the current directory does not change, other environmental variables constant

②su - or su -l or su --login: switch to the root user, and change the working directory, and SHELL, USER, PATH, HOME, LOGNAME variable

③su username: switch to another user, the directory does not change, SHELL, USER, PATH, HOME, LOGNAME variable is changed

④su -, -l, --login username: Switch to a different user, change the working directory, and SHELL, USER, PATH, HOME, LOGNAME variable

⑤ Other parameters:

2, sudo command

sudo command: sudo as superuser do shorthand, i.e., super user to execute the command, generally refers to the root user

sudoers file stored in the etc directory, we can enter the command visudo edit sudoers file directly, using the visudo command to edit the file, it will verify the information we have added a syntax error

sudo -l command: View the current user can execute commands with sudo what are

Here is mainly written, root on behalf of the user, on behalf of the host ALL, ALL parentheses represents the identity of what has been run, the last representative of ALL command to be executed.

In the file add: jack ALL = (root) / bin / date, save, switch user, execute the command

Guess you like

Origin www.cnblogs.com/majingyan/p/12214557.html