Skip to content

Instantly share code, notes, and snippets.

@beenotung
Created May 23, 2024 11:21
Show Gist options
  • Save beenotung/c7774b54ef73171ee13fff2d1b041818 to your computer and use it in GitHub Desktop.
Save beenotung/c7774b54ef73171ee13fff2d1b041818 to your computer and use it in GitHub Desktop.
steps to add new public key to ssh server

Step 1: Login to the ssh server

Option 1: login with ssh server with "ssh <server_name>" from a device that is already authorized

Option 2: login from the web console if your device is not already authorized

Step 2: add the public key to .ssh/authorized_keys

For easier reference, you can add comment to describe the key.

Example using vim:

  1. vim .ssh/authorized_keys
  2. press "G" to go to last line
  3. press "o" to add new line and enter insert mode
  4. add user name with # as comment
  5. add device name with # as comment
  6. paste the public key
  7. press "Esc" to back to normal mode
  8. press ":x" with Enter to save the file

Example file content of .ssh/authorized_keys:

# Beeno
# Beeno Kudu Laptop
ssh-rsa AAAAB3NzaC1yc2...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment