How can I Change or Create Root/User Password in Centos 8

After installing centos8 as your VPS distribution, you need to change the root password as well as the user’s account password. Changing this credential is super easy in centos 8 VPS and you can manage it yourself. In this article, I will explain how you can change or create a new password for the root user and centos user.
Step 1: Login to your VPS using the user id and password. These details will be sent to your email id from your VPS service provider.
Step 2: When you first login in VPS, most probably you will be login as the user’s account not the root account. You can change root password using the following two methods.

Changing the Root Password

  1. Login as root and then change the password.
  2. Type sudo -i and press Enter. It will login you as a root user.
  3. Type passwd and press Enter.
  4. You may also change password directly by sudo command. Just write the following command and press Enter. sudo passwd root
  5. Type your New Password and Press Enter. Retype your password and press Enter. You will get the message "all authentication tokens updated successfully."

Changing the User Account Password.

  1. Login to user account which password you want to change.
  2. Now type the following command and press enter. passwd
  3. It will let you create password for the current user account. It will ask you your current user account password for confirmation. After providing the current password it will allow you to create a new password for that user account.

What If I don't have the User's Password?

  1. If you don't know the current user password but you have sudo privilege, then you can change any user account password as follows. sudo passwd your_user_account example: sudo passwd centos
  2. It will allow you to change user's password directly.
  3. Guideline for creating password.

    1. Password must be 8 characters long.
    2. It must contain Numbers (0-9), Letters (Uppercase and Lowercase) and symbols.
    3. Password must not a dictionary word, your name, date of birth, or easy to guess.


    In this article, I have defined how can you change root password as well as the user’s password in the Centos 8 VPS. Just use the passwd command to change the password.

Coffee Request!

It takes time and hardwork to manage and keeping alive this site. Meanwhile, we need coffee to be refereshed. Can you please buy a coffee for me!

  Related articles