Enable SSH Password Authentication on a RunPod Pod
When connecting to a RunPod Pod, a common issue is that SSH doesn't work out of the box. In this tutorial, we will examine a method of using a username and password to access a RunPod Pod through SSH. By the end of this guide, you'll be able to securely connect to your Pod using password authentication.
Prerequisites
Before you begin, ensure that you have the following:
- A RunPod Pod that you can access and modify
- Basic knowledge of using the command line and SSH
Setting the Root Password
The first step is to set a password for the root user on your Pod. This can be done by running the following command:
passwd root
You will be prompted to enter a new password. It's crucial to set a strong password here. Consider using a password generated by a password manager or follow the guidelines provided by the Electronic Frontier Foundation (EFF) for creating secure passwords.
Next, see how to enable password authentication.
Enabling Password Authentication
If your Pod doesn't have Vim installed, you can install it using
apt update; apt install vim
.
To enable password authentication for SSH, follow these steps:
-
Access the SSH configuration file:
vi /etc/ssh/sshd_config
-
Locate the line that starts with
PasswordAuthentication
. Uncomment it if necessary and set its value toyes
:PasswordAuthentication yes
-
(Optional) If you want to allow root login with a password, find the line that starts with
PermitRootLogin
. Change its value toyes
:PermitRootLogin yes
-
(Optional) If you want to disable public key authentication, add or modify the following line:
PubkeyAuthentication no
-
Save the changes and exit the editor. In vi, you can do this by pressing
Esc
, then typing:wq
and pressingEnter
. -
Restart the SSH service to apply the changes:
service ssh restart
Now that your password is set and you've applied changes, access your Pod.
Accessing the Pod
With password authentication enabled, you can now SSH into your Pod using a username and password:
ssh username@server_ip -p port
Replace username@server_ip -p port
with the appropriate values.
You can find this information by clicking the "Connect" button on your Pod's page in the RunPod dashboard.
Enter the password you set earlier when prompted, and you should now be connected to your Pod via SSH using password authentication.
Conclusion
In this article, you learned how to enable SSH password authentication on a RunPod Pod.
By setting a root password and modifying the SSH configuration file, you can now securely connect to your Pod using a username and password.
Remember to always use strong passwords and consider disabling password authentication and using public key authentication instead for enhanced security.