sudo authorization, and later blog friends reminded me, directly editing the sudoers file is still risky for new contacts with linux, more directly using vi to edit the file can not be achieved Grammar check, but also need to modify the permissions of the default file, very troublesome, then reprint a 51CTO blogger's article, tells the use of visudo accessories sudo permissions, the advantage of this command is that you can achieve language check, but the ultimate goal is still The same is true for modifying the sudoers file.
sudo is a very useful tool on the Unix/Linux platform that allows non-root users to give some reasonable rights to perform only some root or privileged users. Tasks, which reduce the number of logins and management time for root users, also increase system security.
1, General User Empowerment Settings:
[root@localhost ~]# visudo…… omitted in front ## Syntax:#### user MACHINE=COMMANDS #### The COMMANDS section may have other options added to it.#### Allow root to run any commands anywhereroot ALL=(ALL) ALLtest ALL=(root) /usr/sbin/useradd ##New user line &hellip ;… omitting
Description: The first field: root is the user who can use the sudo command; the second field: the first ALL is the host that allows sudo, the second is the ALL in parentheses The command is executed in order to use sudo (the user of the destination); the third word: ALL is the command allowed to execute with the sudo command; the above explanation: test ALL=(root) /usr/sbin/useradd indicates that test is allowed The user logs in from any host and executes the /usr/sbin/useradd command as root. User execution command effect:
[root@server ~]# su - barlow[redhat@server ~]$ sudo /usr/sbin/useradd test##Command is best to enter the full path password: ##这里Enter the user barlow's own password [redhat@server ~]$ cat /etc/passwd |
Tail -5xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologingdm:x:42:42::/var/gdm:/sbin/nologinsabayon:x:86:86:Sabayon User:/home/sabayon:/sbin/nologinredhat:x:500:500::/home/redhat:/bin/bashtest:x:501:501::/home/test:/bin/bash ##Newly added User
2, sudo configuration in-depth:
1) settings of multiple users (non-same group users): For users with different needs: you can add multiple lines in turn according to the above method. Each row corresponds to one user. For multiple users of the same requirement User_Alias UUU=user1,user2…… define user aliases;
[root@localhost ~]# visudo…… omitting ## User Aliases## These aren't often Necessary, as you can use regular groups## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname## rather than USERALIASUser_Alias ADMINS = jsmith, mikem ##This is an instance line, follow this Write your own User_Alisa sudouser=user1,user2,user3,user4 ##first alias suduouser……after omit ## Syntax:#### user MACHINE=COMMANDS#### The COMMANDS section may have other options added to It.#### Allow root to run any commands anywhereroot ALL=(ALL) ALL77 sudouser ALL=(root) /usr/sbin/useradd ##Command line writing format, user column with alias …… omitted
Settings for multiple commands: Cmnd_Alias CCC=command1,command2…… Define command aliases;
[root@localhost ~]# visudo…… omitted ## Comma Nd Aliases## These are groups of related commands...## NetworkingCmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dh client, /usr/bin/net, /sbin/iptables , /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool ##Multiple commands define a command alias; …… omits later ## Syntax:#### User MACHINE=COMMANDS#### The COMMANDS section may have other options added to it.#### Allow root to run any commands anywhereroot ALL=(ALL) ALL77 sudouser ALL=(root) NETWORKING ##Command line writing format, The command line is aliased with ……
date command The function of the date command is to display and set the system date and time. The ge
How do I use a USB-based storage device in a Linux environment? This
A.Linux files can be divided into four types: ordinary files, directory files, link files, and devi
How to let CentOS ban ping (anti-PING)
How does the Linux system change face Win8 Linux system Win8 skin
How to fix "fatal error: security/pam
The relationship between Linux and Android
Linux file search technology Daquan
Linux available disk capacity adjustment reserved space
Ubuntu system encrypts files for transmission method
Method of killing process commands under Linux operating system
Software-only dual-system hot standby solution in-depth analysis
Win10 system app store uninstallation method
WinScreen system blue screen appears BlueScreen error code solution
Win8 forget the power-on password how to do
Win8 Windows Firewall Setting Tips Keep away from third-party fighter protection software
What can I do if Win8 cannot delete the residual LuDaShi folder?
Windows7 system wallpaper can not be centered how to do
Redis Installation and Configuration Tutorial
How to upgrade Win10 preview to win 10102?
How to choose several versions of Win8 system? How many versions does