Ubuntu Users and Groups Management

User Commands
passwd Change own password
whoami Who am I?

Sudo command
sudo -i Elevate permission and log in as the root account
sudo adduser username sudo Add a user to the sudo group:
sudo getent group sudo
Check members of sudo group

User Management
cut -d: -f1 /etc/passwd List Users
sudo adduser new_username Add a new user you can use:
sudo userdel username Remove/delete user
sudo rm -r /home/username Delete the home directory for the deleted user account
usermod -l new_username old_username Modify the username of a user:
sudo passwd username Change the password for a user:
sudo chsh username Change the shell for a user:
sudo chfn username Change the details for a user (for example real name):
sudo adduser username sudo Add a user to the sudo group:

Enable Root User
sudo nano /etc/passwd
sudo nano /etc/shadow
The character “x” represents a blank or empty password.
The character “!” represents that password is locked.

sudo passwd root
sudo passwd -u root
To unlock the account. This should return
passwd: password expiry information changed

Change this as well
sudo nano /etc/ssh/sshd_config
PermitRootLogin prohibit-password change to
PermitRootLogin yes
sudo service ssh restart

Change the root password in Ubuntu
Type the following command to become a root user and issue passwd:
sudo passwd root
Test it with your root password by typing the following command:
sudo -i
su –

Groups
sudo groups List Groups
sudo groups wpk Get groups where user wpk is a member