add a user
Create an account with a home folder and a password, and let it use sudo if it should.
Steps
-
sudo adduser NAMEcreate the user, its home folder and its password, asking for each (Debian, Ubuntu)
-
sudo useradd -m -s /bin/bash NAMEthe same on any Linux: a home folder (-m) and bash as its shell
-
sudo passwd NAMEset its password (needed after useradd)
-
sudo usermod -aG sudo NAMElet it use sudo; the group is `wheel` on Fedora, RHEL and Arch
-
id NAMEcheck its groups
-
sudo -iu NAMEopen a shell as that user, to try it
Notes
- Keep the
-ainusermod -aG: without it, the user is taken out of every other group. - A new group takes effect at the user's next login.
- macOS: System Settings, Users & Groups, or
sysadminctl -addUser(see its manual).
Commands used
adduseruseraddusermodpasswd
Each has a page in lore: lore adduser opens it.
Related recipes
- list users and groupsSee the accounts on this machine, the groups, and who is in each.
- change permissions of a folder and everything in itGive a folder, its subfolders and its files the permissions or the owner they need, without making them open to everyone.
- count the processorsHow many processors and cores this machine has, and what they are.
- find what killed a processA program vanished or says "Killed": usually the kernel ran out of memory and stopped it. Find out.