Skip to content

Instantly share code, notes, and snippets.

@SpaceNerden
Last active February 18, 2023 01:18
Show Gist options
  • Save SpaceNerden/6964e834509c3735d39301b74b7f96e7 to your computer and use it in GitHub Desktop.
Save SpaceNerden/6964e834509c3735d39301b74b7f96e7 to your computer and use it in GitHub Desktop.
Set up SSH keys on linux: The lazy way

This assumes a couple of things.

  1. You want more keys in the future.
  2. You are on linux.

Step 1: Generate the key.

ssh-keygen -f ~/.ssh/<Name of key, can be anything> -N ''

Step 2: Add following to ~/.ssh/config

Host <IP Address>
        User <User>
        IdentityFile ~/.ssh/<Name of key>
        IdentityFile ~/.ssh/<Name of key>

Step 3: Add key to server

ssh-copy-id -i ~/.ssh/<Name of key>.pub user@ipaddress

Step 4: Be happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment