Here are the general steps for setting up SSH keys on Ubuntu 20.04:
Open a terminal on your local machine.
Run the following command to generate a new SSH key:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Press enter to accept the default file location, or enter a new file location.
Enter a passphrase, and then confirm it.
Run the following command to start the SSH agent:
eval "$(ssh-agent -s)"Run the following command to add the key to the agent:
ssh-add ~/.ssh/id_rsaRun the following command to copy the public key to your clipboard:
xclip -sel clip < ~/.ssh/id_rsa.pubConnect to your remote server via SSH.
Open the file ~/.ssh/authorized_keys on the remote server, and paste the public key into the file.
Save and close the file.
From now on, you should be able to use ssh to connect to your remote server without having to enter your password.
Please note that depending on the ssh config that you have setup and the file names of ssh key you might need to adjust the commands accordingly.
Comments
Post a Comment