☰ Categories

Linux: Basic User administration

Basic User administation

Delete a user:
userdel username
Be sure to delete the home folder if it is no longer in use

Add a user:
useradd username

Add user to specific gid and uid:
groupadd -g 2501 username ; useradd username -u 501 -g 2501 -m -s /bin/bash

Add a group:
groupadd groupname

Add a user to a group:
usermod -a -G groupname username

Change the default group for a user
usermod -g groupname username

If adding to administrator/wheel:
Use: visudo

Remove the # in front of “# %wheel ALL=(ALL) ALL”
Allows people in group wheel to run all commands

Add user to the wheel group:
usermod -aG wheel username

Change or add a users full name. Also called the finger name:
chfn -f “Joe Blow” jblow
usermod -c “Snow John” username