How to change your VPS root password
Changing the root password on your Virtual Private Server is one of the basic security measures to beef up the security of your server against would-be intruders. Below is how you can possibly change the root password for your VPS. The commands may vary slightly, depending on the operating system running on your VPS, but the general process will still be the same.
Step 1: Open Your VPS
The root password is changed when logged in to your VPS via SSH. SSH stands for Secure Shell; it is a cryptographic network protocol for operating network services securely over an unsecured network. A normal SSH client should be installed in your system for accessing the VPS. Generally, a Windows user would use PuTTY, while Linux or macOS users would have the terminal built in.
Step 2: Open the SSH Client and Connect to Your VPS
You need to open your SSH client and use the following SSH command to connect to your VPS, which will connect using your root username and your VPS's IP address. If you have set up another username with sudo privileges, you may use that username in place of root.
Step 3: Write the Current Password
After running the SSH command, you will probably get a prompt, as below, communicating with the following screen, asking you to input the current password for the root user. You need to type in whatever your password is and press Enter. If you entered the correct password, you should be logged in to your VPS.
Step 4: Change the Root Password
On logging in, you can change the root password by running the command relative to your system. You are required to input the new password for the root user after typing the usual change password command. The sure thing is—the password has to be complex for your server to be way more secure. A strong password usually includes the upper and lower letters, numerics, and some special characters.
Step 5: Again Re-Enter the New password
When you have entered the new password, a prompt is given to retype new password again for confirmation. Be very careful to type the password the same as the exact way as in step one. If the two entries match, you will receive a message showing that password is updated successfully.
Step 6: Verify the Change
It is always considered a good practice to confirm that the password has been changed. You can verify this by logging out of your SSH session and logging in once again using the new password. A prompt to enter a password will be displayed. In this case, enter the new root password. If you are able to log in, then the password has been successfully changed.
Some Extra Hacks for More Security
1. Disable Root Login: Take your sshd_config and disable the root login. Then get yourself a user with sudo privileges, if you're in some intense security. This way, your server is secured, and your root account cannot be logged into, even through brute force. Open up your SSH configuration file. Find the line PermitRootLogin in the SSH configuration file. Change it from "no" to "yes" and restart the SSH service. Change to "no" and save the file. Restart SSH.
2. Use SSH Keys: Use SSH keys to get into servers instead of logging in with plain password authentication. SSH keys are definitely more secure and help avoid having to remember complex passwords all the time. Generate an SSH key pair on your local computer and then transfer the public key to the VPS.
3. Keep Updating Regularly: Regularly update and upgrade to avail of all security patches and software updates. This will keep your VPS protected from threats that can potentially target vulnerabilities.
Changing your VPS root password will be a simple yet important step towards your secure server. Just be sure to update your password frequently, use strong passwords, and tuck in some enhanced security measures such as disabling root login and utilizing SSH keys. Follow these steps so that your server will be secured from unauthorized access and potential threats.