Ubuntu don’t allow you to directly use “root” user in the safe’s sake.
Thus, you need use “SUDO” command, to act like operating with root rights. And don’t have to change to root user. This is definitely a brilliant idea. You can check the sudo list by using command :
The file looks like following :
As the comment you can see, must use visudo command as root user to modify this file :
We can see following line, what does it mean?
It means user root can execute from ALL terminals, acting as ALL (any) users, and run ALL (any) command.
So the format is :
Some examples :
Thus, you need use “SUDO” command, to act like operating with root rights. And don’t have to change to root user. This is definitely a brilliant idea. You can check the sudo list by using command :
1 | less /etc/sudoers |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # Defaults env_reset # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL) ALL # Allow members of group sudo to execute any command # (Note that later entries override this, so you might need to move # it further down) %sudo ALL=(ALL) ALL # #includedir /etc/sudoers.d # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL |
1 | sudo visudo |
1 2 | # User privilege specification root ALL=(ALL) ALL |
So the format is :
1 | [user] [terminal that use sudo]= ( [as which user he may act] ) [commands he may run] |
1 2 3 4 5 6 7 8 9 10 11 12 | rhoneldo ALL=(OP) ALL # The user rhoneldo can run any command from any terminal as any user in the OP group (root or operator). zidane OFNET=(ALL) ALL # user zidane may run any command from any machine in the OFNET network, as any user. backham ALL= PRINTING # user backham may run lpc and lprm from any machine. nakata ALL=(ALL) ALL NO PASSWD: ALL # do not ask to fill password when user nakata using sudo |
No comments:
Post a Comment