Skip to content

Instantly share code, notes, and snippets.

@pavankjadda
Last active September 16, 2023 13:26
Show Gist options
  • Save pavankjadda/b1cc2bb599f6f27a95fc0f30d0f627fc to your computer and use it in GitHub Desktop.
Save pavankjadda/b1cc2bb599f6f27a95fc0f30d0f627fc to your computer and use it in GitHub Desktop.
SSH key authentication in Linux
  1. Open Terminal on local machine

  2. Paste the text below, substituting in your email address.

  ssh-keygen -t rsa -b 4096 -C "[email protected]"
  1. Copy the key to remote server using the following command. Enter the password when prompted
  ssh-copy-id username@server_ip_address
  1. Now test the SSH or SCP command, it shouldn't ask for password. If it does, remove home directory or ssh keys from remote machine
ssh username@server_ip_address
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment