User Management
Cookbook
Section titled “Cookbook”- Check current users
cat /etc/passwd
- Create user
- with adduser, adduser is a perl script that uses useradd in the background, it will also create home directory etc. adduser is not available on every distro.
sudo adduser {{username}}
- useradd (will not prompt you for a password)
useradd guestpasswd guest
- with adduser, adduser is a perl script that uses useradd in the background, it will also create home directory etc. adduser is not available on every distro.
- Add existing user to the sudo group
- with adduser
sudo adduser {{username}} sudo
- with usermod (generic option)
sudo usermod -aG sudo {{username}}
-a: append-G: group
- in fedora, the sudo group is called
wheelsudo usermod -aG wheel {{username}}
- with adduser
- Add a user, create a home dir, and add to the sudo group in one go (afterwards, you still need to set up the password using
sudo passwd {{username}})sudo useradd -m -s /bin/bash -G sudo {{username}}-m: will create a home directory-s: will set the default shell for the user-G {{groupname}}: will add the user to the group specified