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
- Login as root and then change the password.
- Type
sudo -i
and press Enter. It will login you as a root user.
sudo -i
$ Enter root password: - Type
passwd
and press Enter.
passwd
Changing password for user root. New password: - You may also change password directly by
sudo
command. Just write the following command and press Enter.sudo passwd root
sudo passwd root
Changing password for user root. New password: - Type your New Password and Press Enter. Retype your password and press Enter. You will get the message "all authentication tokens updated successfully."
sudo passwd root
Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully.
Changing the User Account Password.
- Login to user account which password you want to change.
- Now type the following command and press enter.
passwd
- 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.
passwd
Changing password for user centos. New password: Retype new password: passwd: all authentication tokens updated successfully.
What If I don't have the User's Password?
- 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
- It will allow you to change user's password directly.
sudo passwd centos
Changing password for user centos. New password: Retype new password: passwd: all authentication tokens updated successfully. - Password must be 8 characters long.
- It must contain Numbers (0-9), Letters (Uppercase and Lowercase) and symbols.
- Password must not a dictionary word, your name, date of birth, or easy to guess.
Guideline for creating password.
Summary
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.