How to set up ssh keys on ubuntu server 18.04
Aug 11, 2021
Follow these steps to set up public key authentication:
Step 1 : Change to the home directory with cd ~/
cd ~/
Step 2 : Create a .ssh directory if it doesn't already exist
mkdir .ssh
Step 3 : Create a file named authorized_keys under the .ssh directory
touch .ssh/authorized_keys
Step 4 : Set permissions on the .ssh directory to 700
chmod 700 .ssh
Step 5 : Set permissions for authorized_keys to 600
chmod 600 .ssh/authorized_keys
Step 6 : Generate public key pair on your local system with the following command
ssh-keygen
Step 7 : Copy the generated public key from the .ssh/id_rsa.pub file to the authorized_keys file on the server.
Step 8 : Now, open an ssh connection from local to server with the following command:
ssh ubuntu@server
Recommended
Mar 29, 2024
Mar 27, 2024
Mar 27, 2024
Mar 27, 2024
Mar 27, 2024
Mar 27, 2024
Mar 27, 2024
Mar 27, 2024
Mar 26, 2024
Mar 26, 2024
Mar 26, 2024