Add a sudo user under CentOS

Source: Internet
Author: User

Add a sudo user under CentOS
I. sodo usage 1.1 about how sudo Sudo is a linux system in which non-root users can escalate their permissions to execute some special commands, it allows common users to temporarily obtain the root permission without knowing the superuser password.
Generally, when you execute a special command, you only need to add sudo to a Special Command (such as yum) and enter your user password. in the next five minutes, when you use a special command again, you do not need to enter the user password again.
At the same time, sudo provides powerful log management, which records in detail what each user has done.
Sudo user management is stored in files:/etc/sudoers. That is to say, if you want to add a user to The sudo user group, you need to configure the file by yourself. When reading and writing this file, you need the root permission.


2.1 Add a user to sudo if "xxx is not in thesudoers file" appears when using sudo. this incident will be reported "indicates that the current user name: xxx has no permission to use sudo. In This case, we need to modify/etc/sudoers to add sudo permissions to the current user xxx.

  1. Run the "su-" command to enter the super user, and enter the etc directory "cd/etc"
  2. Add write permission to the sudoers file: Use the command "chmod u + w sudoers"
  3. Run the "vim sudoers" command, press "I" to enter the editing mode, find "rootALL = (ALL) ALL", and add "xxxALL = (ALL) ALL "(here xxx is your user name), click" Esc "to exit the editing, enter" wq "(write quit), and then exit sudoers.
  4. Enter "chmod u-v sudoers" To unwrite the file.
  5. Switch back to your username through "su xxx", and then use the sudo command.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.