How to Set Up SSH Key Login for aaPanel Server
SSH key authentication provides a more secure way to access your server compared to traditional password authentication. In this guide, we will show you how to set up SSH key login for your aaPanel server.
Step 1: Generate SSH Key Pair
First, you need to generate an SSH key pair on your local machine. Open a terminal and run the following command:
ssh-keygen -t rsa
Follow the on-screen instructions to generate your SSH key pair. By default, the keys will be saved in the ~/.ssh directory.
Step 2: Copy Public Key to aaPanel Server
Next, you need to copy the public key to your aaPanel server. You can do this using the following command:
ssh-copy-id username@server_ip
Replace username with your username on the server and server_ip with the IP address of your aaPanel server.
Step 3: Configure SSH Key Authentication
Once the public key is copied to the server, you need to configure SSH to use key authentication. Edit the SSH configuration file on your server:
sudo nano /etc/ssh/sshd_config
Find the line that says PasswordAuthentication yes and change it to PasswordAuthentication no. Save and close the file.
Step 4: Restart SSH Service
Finally, restart the SSH service on your aaPanel server to apply the changes:
sudo systemctl restart sshd
Now you should be able to log in to your aaPanel server using SSH key authentication.
Conclusion
Setting up SSH key login for your aaPanel server is a simple yet effective way to enhance security. By following the steps outlined in this guide, you can ensure that only authorized users can access your server. Remember to keep your private key secure and avoid sharing it with anyone.