There is a difference between connecting with SSH and generating SSH public and private keys. Be aware that the terminology in your question (public and private keys, "id files", ~/.ssh/
) lead to thinking about user generated SSH keypairs.
The directory you're referring to (~/.ssh/
) is for user generated SSH keypairs, known_hosts
file etc., and installing SSH in itself will not generate a user keypair. If you want to connect with SSH keypairs from Windows, you need to do the following:
- Create a SSH keypair on your Windows machine (off-topic here, but on-topic on Superuser)
- Install the public key you generated on Windows on your Ubuntu machine
Here is a Q&A on Superuser that details how to setup SSH keys on Windows for use with PuTTY, and another one about why and how the keys are stored.
However, if you're referring to the SSH host keys that are generated when installing SSH, those are located inside /etc/ssh
, and can be listed with this command:
$ ls -la /etc/ssh/ssh_host*
-rw------- 1 root root 1373 May 8 2020 /etc/ssh/ssh_host_dsa_key
-rw-r--r-- 1 root root 597 May 8 2020 /etc/ssh/ssh_host_dsa_key.pub
-rw------- 1 root root 492 May 8 2020 /etc/ssh/ssh_host_ecdsa_key
-rw-r--r-- 1 root root 169 May 8 2020 /etc/ssh/ssh_host_ecdsa_key.pub
-rw------- 1 root root 399 May 8 2020 /etc/ssh/ssh_host_ed25519_key
-rw-r--r-- 1 root root 89 May 8 2020 /etc/ssh/ssh_host_ed25519_key.pub
-rw------- 1 root root 2590 May 8 2020 /etc/ssh/ssh_host_rsa_key
-rw-r--r-- 1 root root 561 May 8 2020 /etc/ssh/ssh_host_rsa_key.pub
The public host key is saved on the client machine (as known_hosts
) to verify the identity of the remote machine and mark the connection as "trusted". On Ubuntu, known hosts are saved in ~/.ssh/known_hosts
(refer to Superuser when it comes to Windows).