Ubuntu 18 create new sudo user and change password of user

Creating new user in Ubuntu or Linux Mint and assigning it to sudo users is very easy task if you are using linux shell. I can be done with simple commands like:

  • adduser test - create new user with name test
  • usermod -aG sudo test - add user test to sudo users
  • sudo passwd test - change password for user test

Creating new user in Ubuntu 18

Step by step process of adding new user to Ubuntu( the process is working the same way for Linux Mint or Debian).

  • login with root
  • or connect to Ubuntu via SSH (optional) - only if your Ubuntu is on virtual private server VPS. You can use one of this commands
ssh root@XX.XX.XX.XX
ssh XX.XX.XX.XX -l myuser -p 22
  • adding other user named test. You will be prompted for password and then for user infomation - you can skip all by ENTER :
adduser test
  • add the newly created user to sudo group by:
usermod -aG sudo test
  • verify the new user by login and doing sudo command - you will be asked for the password of the new user.
su - test
sudo ls

Changing user password in Ubuntu 18

Changing password can be done by several commands:

  • changing user test password
sudo passwd test
  • change current logged user password in Ubuntu 18
passwd
  • change root password:
sudo passwd

Related Article