29

I'm on a Windows 10 machine, with an SSH client at C:\Windows\System32\OpenSSH (must be part of the OS these days). I'm used to Unix-land SSH, where there's a configuration file at $HOME/.ssh/config.

My question: Does Windows' OpenSSH have such a file? If it does - where is it located? And if it doesn't - how do you configure it other than through the command-line?

Note: Please don't suggest I use Cygwin or PuTTY. Both of these are fine options, but I'm specifically asking about the Windows-supplied SSH client.

2 Answers 2

32

The OpenSSH configuration and key files (including the config, known_hosts, authorized_keys, id_rsa, id_dsa, etc.), which on Unix go to ~/.ssh, on Win32-OpenSSH they go to %USERPROFILE%\.ssh.

That typically is:

C:\Users\username\.ssh

Though there's an exception for administrator authorized_keys. Win32-OpenSSH uses %ALLUSERSPROFILE%\ssh\administrators_authorized_keys instead. See my guide to Setting up SSH public key authentication on Win32-OpenSSH server.


Win32-OpenSSH is a Microsoft build of OpenSSH, which is now a standard part of Windows 10 and 11.

0
0

As Martin has said, it's in user's directory and under the .ssh folder. I just want to also add a quick sample syntax of a host configuration in this file:

Host somename
    HostName 1.2.3.4   # An address to SSH to.
    User someuser
    Port 22
    IdentityFile ~/.ssh/somename-privatekey.pem
    IdentitiesOnly yes

(Source)

NOTICE 1: The tag named IdentitiesOnly will tell SSH to not try every identity file within that folder, but only the one’s defined. By default, SSH will walk through and try every identity file until it finds the right one.

NOTICE 2: You may also cache the keys and the passphrases using ssh-agent, read more here and here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .