add user to sudoers group on Ubuntu

Asked

Viewed 15,977 times

1

How to create a user and put it in the sudoers list on linux? How to take an existing user and change your group to sweat?

1 answer

3


I tried to find here in SOPT and did not find, I even looked in SOEN but I found a more complete answer in askubuntu, so I will put here what I did to solve, in case the question is duplicated please inform me by the comment that I delete if it is the case.

To add a new user just replace the by your user name:

sudo adduser <username> sudo

If you want to add an existing user to sudo group just do:

sudo usermod -aG sudo <username>

"a" is important so that the user does not leave the other groups, whereas "G" concerns the group where you are placing your user.

Then just go out and log in again for the changes to take effect.

More references in: https://askubuntu.com/questions/7477/how-can-i-add-a-new-user-as-sudoer-using-the-command-line

  • 'Cause I don’t know if that would be on-topic here, since it’s not about programming.

  • In this case they are shell script commands and would fit in bash and not linux?

  • From what I’ve seen on the site, there are people who think it should be accepted, and people who don’t. Let’s see how the community will react to this specific question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.