I want to know how groups work in Linux. In windows users that belong to admin group can have access to everything. So I want to know how to create a user and add that user in Root group or whichever group has access to everything in Linux.
2 Answers
Open a terminal by pressing Ctrl+Alt+T.
In the terminal, type the following command, then press Enter:
sudo adduser USERNAME
This will create a new user (replace USERNAME with the new user's username). It will ask you to enter a password for the new user, as well as a bunch of other optional information (full name, phone number, etc). Now, add that user to the sudo group:
sudo adduser USERNAME sudo
(again, replace USERNAME with the new user's username). This will allow the new user to run any command as root by typing:
sudo COMMAND
in the terminal, and then entering the new user's password.
- 104,119
- 1,555
Most likely you do not need to do that. If you type id you can see what groups you are in:
$ id
uid=1000(zanna) gid=1000(zanna)
groups=1000(zanna),4(adm),7(lp),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),129(sambashare),1001(unicorns)
Oh look I am in a group called sudo... that means I am allowed to issue commands as the superuser... which commands am I allowed to use in that way?
$ sudo -l
User zanna may run the following commands on monster:
(ALL : ALL) ALL
That's probably enough privileges :)
Here's a good question about managing users and groups in Ubuntu as pointed out by Anwar Shah. The Arch wiki also gives insight.