1

I'm running Ubuntu 15.10 on different machines.

On one of those I had to create a new user from command line (adduser) and then I added it to /etc/sudoers to give admin authorizations to that user.

Later, on another machine, I created a new admin user from System settings → user accounts, but when I check in the /etc/sudoers file, I don't find any entry for the admin user.

Why does it happen? Are users created through graphical interface listed in a different way in different files? If that is the case, what are files with the entries of new admin user created?

1 Answers1

3

You don't add a user to the /etc/sudoers file to grant him to use sudo to become root, but you just add him to the sudo and adm groups:

sudo adduser USERNAME sudo
sudo adduser USERNAME adm

This is also what the GUI does when you select "Administrator" as account type.

Byte Commander
  • 107,489
  • Ok thank you.

    Is USERNAME listed in some files?

    – floatingpurr Mar 08 '16 at 11:59
  • I read a lot of examples where they add USERNAME to /etc/sudoers to become root. But I can do the same thing, just adding him to the sudo and adm groups. Is it the best way? – floatingpurr Mar 08 '16 at 12:04
  • 1
    Yes, group members are listed in the file /etc/group. You can check the lines of the mentioned two groups using the command grep 'sudo:\|adm:' /etc/group. – Byte Commander Mar 08 '16 at 12:38
  • 1
    Using the group method is in my opinion the best way, as it's also the default way the GUI does it and the way your initial user account is set up. Not sure if the groups have any additional effects over that (probably yes, but I don't know them). Also adding a user to a group is far easier and less dangerous than modifing /etc/sudoers. – Byte Commander Mar 08 '16 at 12:41