How to Manage Users on Ubuntu

In this guide, I will show you how to manage your users on Ubuntu via command line.

Most of these commands assume you are root so no need to use sudo.

1. How to list all local users on Ubuntu?

cut -d: -f1 /etc/passwd

2. To add a user on Ubuntu

adduser username

3. To delete a user on Ubuntu

userdel username

4. Remove user home folder on Ubuntu

rm -fr /home/username

5. To modify the username of a user on Ubuntu

usermod -l new_username old_username

6. To change the password of a user

passwd username

7. To change the shell of a user

chsh username

8. To add a user to the sudo group

usermod -aG sudo username

Leave a Reply

Your email address will not be published. Required fields are marked *