Manage Windows SSH keys

The generated key consists of a pair of files, one private and one public. It’s very important that you never share the private key, ever. While you will use the public key to authenticate with the external service.

Check for existing keys

Check for existing keys using command prompt:

# if you get "No such file or directory" then you don't have any keys
cd %userprofile%/.ssh

# if you get "File Not Found" then you don't have any key
dir id_*Code language: PHP (php)

If you already have an ssh key/s then you may like to reuse it. If you prefer not to, or don’t yet have an shh key then proceed to the next section.

Creating a key

ssh-keygen -t rsa -C ""Code language: JavaScript (javascript)

(Press enter) when prompted to enter a file in which to save the key.

(Optional) enter a passphrase. I prefer to use one. Each time you connect to a service using the key you’ll be asked for this password.

Note: you must already have git installed with git bash for this command to work. You can get git here.

# open the key with notepad ready to copy and paste for use
notepad id_rsa.pubCode language: PHP (php)

Connect via SSH using Command Prompt

You’ll need to upload the public key to the service first.

ssh -l -p <port> <username>@<server>Code language: HTML, XML (xml)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.