How to enable secure PGP key login on a cloud Linux server and disable password login - read the detailed guide below. This is a good practice to make your cloud server more secure.
To enable PGP key login and disable password login on a Linux server, you can follow these steps:
Generate a PGP key pair on your client machine using a tool like gpg.
Transfer the public key to the Linux server and add it to the authorized keys file for the user account you want to use for PGP key authentication. The authorized keys file is typically located at ~/.ssh/authorized_keys. You can add the public key to the file using a command like:
$ cat my_pubkey.gpg >> ~/.ssh/authorized_keys
Edit the SSH configuration file /etc/ssh/sshd_config and make the following changes:
# Disable password authentication
PasswordAuthentication no
# Enable public key authentication
PubkeyAuthentication yes
# Specify the path to the authorized keys file
AuthorizedKeysFile ~/.ssh/authorized_keys
Restart the SSH service to apply the changes:
$ sudo systemctl restart sshd
After completing these steps, you should be able to log in to the Linux server using your PGP key instead of a password. Note that you will need to have the private key available on your client machine in order to authenticate with the server.
No comments:
Post a Comment