How Can We Help?
Enabling Password Authentication for VPS SSH Access
Introduction
By default, PD Hosting’s VPS instances are set up to utilize key pair authentication for enhanced security. However, depending on your specific needs, you might require password authentication. This guide will walk you through enabling password-based SSH login on your VPS instance for various operating systems including Ubuntu, CentOS, Debian, FreeBSD, and OpenSUSE.
Pre-requisites
Ensure you have access to your VPS instance either through the Console access in the PD Hosting Client Area or an SSH Key.
Step-by-Step Guide
1. Access your VPS Instance
First, log in to your PD Hosting Client Area. Navigate to the Product Details page and click on “Connection Details”. Click the “Console” button to connect to your VPS instance, or use the SSH Key to establish a connection.
2. Set a Password for the User
In the console, you’ll need to set a password for the user you’ll be logging in as. For most operating systems, you can use the following command to set a password for the root user:
sudo passwd root
In FreeBSD, the ‘sudo’ command may not be installed by default. Instead, use:
su root
passwd
3. Modify the sshd_config File
You’ll need to edit the sshd_config file to enable password authentication. Open the file with a text editor like nano or vim using the following command:
sudo nano /etc/ssh/sshd_config
On FreeBSD, use:
ee /etc/ssh/sshd_config
In the sshd_config file, locate the line containing the ‘PasswordAuthentication’ parameter and change its value from ‘no’ to ‘yes’:
PasswordAuthentication yes
To enable ‘root’ login, locate the ‘PermitRootLogin’ parameter and change its value from ‘prohibit-password’ to ‘yes’. If the parameter is not present, you can add a new line with the following:
PermitRootLogin yes
Save the changes and exit the editor.
4. Restart the SSH Service
For the changes to take effect, you’ll need to restart the SSH service. Depending on your operating system, use one of the following commands:
- Ubuntu, Debian:
sudo service ssh restart
- CentOS, OpenSUSE:
sudo systemctl restart sshd
- FreeBSD:
service sshd restart
5. Log in Using Your Password
You can now log in to your VPS instance using the password you set for the root user. Use the following command, replacing ‘your_VPS_ip_address’ with the actual IP address of your VPS:
ssh root@your_VPS_ip_address
Conclusion
Remember, your password’s security is crucial. Keep it complex and confidential to prevent unauthorized access to your VPS instance.
You should now be able to log in to your VPS instance using password authentication. If you encounter any issues or require further assistance, don’t hesitate to contact our support team.