Skip to main content

Setup SSH

  1. Open Command Prompt
ssh-keygen
  1. Enter for next steps
Generating public/private ed25519 key pair.
Enter file in which to save the key (C:\Users\<username>/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
  1. Output would look somewhat like this
Your identification has been saved in C:\Users\<username>/.ssh/id_ed25519
Your public key has been saved in C:\Users\<username>/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx computer_name
  1. Use the following command to add the key to ssh server
type C:\Users\<username>/.ssh/id_ed25519.pub | ssh <username>@<server> "cat >> .ssh/authorized_keys"
  1. Check if it works (even if the previous command prints out permission denied)
ssh <username>@<server>
  1. If doesn't work, mannually copy the key in id_ed25519.pub to .ssh/authorized_keys
ssh <username>@<server>
[log in]
cd .ssh
cat authorized_keys
[paste the public key here]
  1. Create alias
  • Go to folder C:\Users\<username>/.ssh
  • Check if there is config file
  • If not, create a new one
  • Add the following content:
Host <name>
HostName <server>
User <username>
IdentityFile C:\Users\<username>\.ssh\id_ed25519
  • Save file, make sure the type is File
  • Log in to the server using ssh <name>

7b. Example:

Host abc
HostName abc.universe.us
User a_nice_user
IdentityFile C:\Users\a_nice_user\.ssh\id_ed25519

log in: ssh abc