How to add a user to a Sudo group in Linux

Source: Internet
Author: User

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.

The Default User Created by fedora 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.

Su-(Note that there is-, which is different from su. When the "su" command is used, the system only switches to root, but does not pass the root environment variable, or the currently used environment variable. Use the "su-" command to bring the environment variable together, just like root login)

Then

Mongodo

This is the same as vi usage. As some people may be unfamiliar with vi, let's take a brief look at the steps.

Move the cursor to the last line, press a, and enter the append mode.

Your_user_name ALL = (ALL)

Press Esc, enter w to save the file, and then exit q.

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

If you find it troublesome to enter the password during sudo, replace the entered password with the following content:

Your_user_name ALL = (ALL) NOPASSWD: ALL

As for security issues, I think this is also acceptable for individual users.

Related Articles]

  • Fedora upgrades sudo
  • Mandriva upgrade to sudo
  • Use the sudo command to assign management permissions to Ubuntu ADSL

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.