Skip to content

Instantly share code, notes, and snippets.

@ToanPV90
Created August 21, 2016 03:20
Show Gist options
  • Save ToanPV90/7d640f2b7450b9feb4c2f5e54eaaaa91 to your computer and use it in GitHub Desktop.
Save ToanPV90/7d640f2b7450b9feb4c2f5e54eaaaa91 to your computer and use it in GitHub Desktop.
Add and Del user Ubuntu
To list all local users you can use:
cut -d: -f1 /etc/passwd
To list all users capable of authenticating (in some way), including non-local, see this reply: http://askubuntu.com/a/414561/571941
Some more useful user-management commands (also limited to local users):
To add a new user you can use:
sudo adduser new_username
or:
sudo useradd new_username
See also: What is the difference between adduser and useradd?
To remove/delete a user, first you can use:
sudo userdel username
Then you may want to delete the home directory for the deleted user account :
sudo rm -r /home/username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment