CentOS adds users to the sudoer list CentOS by default, linux does not include the current user in the sudoer list (the most common in the linux release of the redhat series ), if you use sudo to execute some commands, you will be prompted that the user is no longer in the sudoer list .... CentOS adds users to the sudoer list CentOS by default, linux does not include the current user in the sudoer list (the most common in the linux release of the redhat series ), if you use sudo to execute some commands, you will be prompted that the user is no longer in the sudoer list. At this time, we need to manually add. 1. enter $ su in the command line, enter the password of the root account, and switch to the root account. $ is the command prompt, so you do not need to press 2. type # cmddo in the command line to open the sudo configuration file. In linux, any configuration file is saved as a text file, that is, you can use vim to open the sudo configuration file, but it is not recommended to do so, because mongodo is a tool provided by linux to modify the sudo configuration file, compared with vim, it provides more prompt information and error correction capabilities. 3. like editing a text file with vim, we search for the root keyword, so enter/root 4 in the open file. press the n key on the disk, and the next root keyword will be automatically jumped to this sentence: # Allow root to run any commands anywhereroot ALL = (ALL) ALL, press n, and the cursor will appear on the root of root ALL = (ALL) ALL. enter yyp and press Enter. these are the two commands in vim. Yy indicates copying the current line, and p indicates pasting the copied content to the next line. Therefore, after entering this command, the original text is changed to the following: # Allow root to run any commands anywhereroot ALL = (ALL) ALLroot ALL = (ALL) ALL 6. press the j Key, the cursor will jump to the second root ALL = (ALL) ALL line, then press the number 0 key, let the cursor back to the beginning of the line, then press 4 x key, delete the four root letters in the row. Press the I key to enter the insert mode and enter your user name. for example, if my current user name is xin, I enter xin. After the input, the original text becomes as follows: # Allow root to run any commands anywhereroot ALL = (ALL) ALLxin ALL = (ALL) ALL 7. press the ESC key (in the upper left corner of the keyboard, on the left side of F1) to launch the insert mode. Press: wq to exit and save the current configuration file. 8. now the modification is complete. the user xin has been added to the sudoer list. you can use the user xin to execute the sudo command.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.