How do I set a SSH key to my profile? #9652

Closed
opened 2026-01-31 02:00:15 +00:00 by claunia · 5 comments
Owner

Originally created by @TomLewis on GitHub (Jul 16, 2020).

First time setting up Windows Terminal, I found random docs that explain how to make a profile, but none of them explain how on earth to set the path of your SSH key to login to the SSH server.

Originally created by @TomLewis on GitHub (Jul 16, 2020). First time setting up Windows Terminal, I found random docs that explain how to make a profile, but none of them explain how on earth to set the path of your SSH key to login to the SSH server.
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 02:00:15 +00:00
Author
Owner

@DHowett commented on GitHub (Jul 16, 2020):

I quickly did an internet search for "windows set up ssh key" and found the following pages:

@DHowett commented on GitHub (Jul 16, 2020): I quickly did an internet search for "windows set up ssh key" and found the following pages: * https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement * https://phoenixnap.com/kb/generate-ssh-key-windows-10#htoc-step-3-use-openssh-to-generate-an-ssh-key-pair
Author
Owner

@TomLewis commented on GitHub (Jul 19, 2020):

But I already have a key, I just need a way to set it in the terminal configs, not create another one, why is this not an option? mobaxterm just allows you to select a key. At the very minimal supporting Pageant.

For anyone else Googling this issue and finding this thread as theres no docs for it, windows now stores .ssh folder the same as MacOS/Linux in C:\Users\user.ssh

You can generate a key with ssh-keygen by using the now built in OpenSSH, when did windows start shipping such tools? No need for WSL, if OpenSSH client isnt installed by default, you can go into Apps & Features and enable it as an additional feature.

@TomLewis commented on GitHub (Jul 19, 2020): But I already have a key, I just need a way to set it in the terminal configs, not create another one, why is this not an option? mobaxterm just allows you to select a key. At the very minimal supporting Pageant. For anyone else Googling this issue and finding this thread as theres no docs for it, windows now stores .ssh folder the same as MacOS/Linux in C:\Users\user\.ssh You can generate a key with `ssh-keygen` by using the now built in OpenSSH, when did windows start shipping such tools? No need for WSL, if OpenSSH client isnt installed by default, you can go into Apps & Features and enable it as an additional feature.
Author
Owner

@viktak commented on GitHub (Jul 23, 2020):

@FrozenBeard I agree.

I already have the generated, it works fine from Putty, but I can't figure it out how to use it with Terminal. At best I get this error message:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:y6xUJD+U4QV0/D9Ze1ILf28wjnDoVJaMw+ojaOm/8o4.
Please contact your system administrator.
Add correct host key in C:\\Users\\Viktor/.ssh/known_hosts to get rid of this message.
Offending RSA key in C:\\Users\\Viktor/.ssh/known_hosts:2
RSA host key for x.x.x.x has changed and you have requested strict checking.
Host key verification failed.

[process exited with code 255]

Is there any info anywhere what key in what format to put in known_hosts?

@viktak commented on GitHub (Jul 23, 2020): @FrozenBeard I agree. I already have the generated, it works fine from Putty, but I can't figure it out how to use it with Terminal. At best I get this error message: ``` @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is SHA256:y6xUJD+U4QV0/D9Ze1ILf28wjnDoVJaMw+ojaOm/8o4. Please contact your system administrator. Add correct host key in C:\\Users\\Viktor/.ssh/known_hosts to get rid of this message. Offending RSA key in C:\\Users\\Viktor/.ssh/known_hosts:2 RSA host key for x.x.x.x has changed and you have requested strict checking. Host key verification failed. [process exited with code 255] ``` Is there any info anywhere what key in what format to put in `known_hosts`?
Author
Owner

@DHowett commented on GitHub (Jul 23, 2020):

@viktak that error message is talking about the identification of the remote host, not your local key.
If your remote hosts are changing identification, especially unexpectedly, that is something you should be extremely worried about.

@FrozenBeard

Windows started shipping OpenSSH a couple major releases ago -- all of it! A server as well (optionally). It's quite neat.

Terminal doesn't need to do any ssh agent or ssh key management responsibilities because there are already well-tested, robust system-level solutions for it. If Terminal were your SSH agent (and implemented Pageant functionality), it suddenly becomes the sole arbiter of your identity. Do you really want your terminal emulator to know about that stuff?

It's easy to set your SSH identity in terminal's config in a way that puts OpenSSH in charge with a profile whose commandline specifies ssh.exe -oIdentityFile=C:\path\to\my\key.

Mobaxterm offers this because it is an SSH client. Terminal simply leverages your existing SSH client. 😄

@DHowett commented on GitHub (Jul 23, 2020): @viktak that error message is talking about the _identification of the remote host_, not your local key. If your remote hosts are changing identification, especially unexpectedly, that is something you should be extremely worried about. @FrozenBeard Windows started shipping OpenSSH a couple major releases ago -- all of it! A server as well (optionally). It's quite neat. Terminal doesn't need to do any ssh agent or ssh key management responsibilities because there are already well-tested, robust system-level solutions for it. If Terminal were your SSH agent (and implemented Pageant functionality), it suddenly becomes the sole arbiter of your identity. Do you really want your terminal emulator to know about that stuff? It's easy to set your SSH identity _in terminal's config_ in a way that puts OpenSSH in charge with a profile whose commandline specifies `ssh.exe -oIdentityFile=C:\path\to\my\key`. Mobaxterm offers this _because it is an SSH client_. Terminal simply leverages your existing SSH client. :smile:
Author
Owner

@viktak commented on GitHub (Jul 24, 2020):

@DHowett I don't think this is the case. The server in question, where I am trying to SSH in is a GoDaddy host. With Putty (using the same key) I can SSH in with no issue.

At this stage I understand (thanks to your comment!) it is not a Terminal issue as Terminal uses ssh built into Windows. So, naturally, I went to a good old fashioned command prompt and tried to connect using this command:

ssh ul8c4oapmt2v@x.x.x.x

The result is the same error message.

Finally, again, using your suggestion, I tried this:

ssh.exe -i C:\Users\Viktor\.ssh\proba1 ul8c4oapmt2v@x.x.x.x

... and it worked!! yay! Both in command line and in Terminal.

Huge thank you for putting me in the right direction!

@viktak commented on GitHub (Jul 24, 2020): @DHowett I don't think this is the case. The server in question, where I am trying to SSH in is a GoDaddy host. With Putty (using the same key) I can SSH in with no issue. At this stage I understand (thanks to your comment!) it is not a Terminal issue as Terminal uses ssh built into Windows. So, naturally, I went to a good old fashioned command prompt and tried to connect using this command: `ssh ul8c4oapmt2v@x.x.x.x` The result is the same error message. Finally, again, using your suggestion, I tried this: `ssh.exe -i C:\Users\Viktor\.ssh\proba1 ul8c4oapmt2v@x.x.x.x` ... and it worked!! yay! Both in command line and in Terminal. Huge thank you for putting me in the right direction!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9652