Add normal users to The sudo Group

Source: Internet
Author: User


If you run the sudo command under a common user, the prompt xxx is not in the sudoers file. This incident will be reported. solution:
$ Whereis sudoers ------- locate the file location, which is/etc/sudoers by default

Sometimes we only need to execute a command with the root permission to su to the root, isn't it inconvenient? In this case, sudo can be used instead. By default, the new user is not in The sudo group. You need to edit the/etc/sudoers file to add the user. The file can only use the mongodo command,

First, you need to switch to root and su-(note that there are-, which is different from su. When you use the "su" command, you only need to switch to root, however, if the root environment variable is not passed, it is still the currently used environment variable. The "su-" command is used to bring the environment variable together, just like the root login ).

Then mongodo or vim/etc/sudoers, and mongodo are used in the same way as vi.

Move the cursor to the next line of root ALL = (ALL) ALL and enter your_user_name ALL = (ALL) ALL;

Save and exit;

In this way, you can add yourself to the sudo group and use the sudo command.

By default, the sodo password just entered five minutes later expires. Next time, you need to re-enter the password for sudo. If you think it is difficult to enter the password during sudo, replace the entered one with the following:
Your_user_name ALL = (ALL) NOPASSWD: ALL.

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.