I know there are a million similar posts, but I have not yet found one that answers this question.
I'm trying to establish an ssh connection from an Ubuntu 18.04 client to the built-in OpenSSH SSH Server on the Windows-10 v1903 build. I do NOT have an Internet domain, so the Windows host will be visible on the Internet only using my ISP's assigned external IP address. To improve security, I want the Windows SSH server to REQUIRE BOTH public key authentication AND user password authentication. Additionally, I have configured the Windows server to use an alternate port for ssh.
On the Windows host, while logged in as test_user, I used the command "ssh-keygen -t ecdsa" to create a user key-pair (with passphrase) and saved it to the file "test_user_key", from an Admin command prompt on Windows, used "ssh-add test_user_key" and confirmed using "ssh-add -l" to list the user even though C:\Users\test_user.ssh\authorized_keys appears to be empty and there is no \ProgramData\ssh\authorized_keys file at all! I then copied the resulting test_user_key private key to /home/xxx/.ssh on my Ubuntu client and set permissions to 600.
With the Windows SSH server \ProgramData\ssh\sshd_config configured with "PubkeyAuthentication yes" and "PasswordAuthentication yes" but with "AuthenticationMethods" commented out, I tested the configuration LOCALLY, with the command "ssh -p 15001 -i test_user_key test_user@192.168.1.168" and, after entering the passphrase for the test_user key and the test_user account password, a connection is established and is confirmed with netstat.
When I reconfigure the Windows sshd_config to enable "AuthenticationMethods publickey,password" then restart the Windows server service, and attempt the connection using "ssh -p 15001 test_user@192.168.1.168" from Linux to Windows, I am refused immediately (i.e. no prompt for the key's passphrase) with "test_user@192.168.1.168: Permission denied (publickey)." as expected because I failed to provide a key.
I then provide the private key using the command "ssh -p 15001 -i test_user_key test_user@192.168.1.168" and am prompted to enter the key's passphrase, but receive the same "test_user@192.168.1.168: Permission denied (publickey)." after entering the passphrase.
I believe the issue is that the actual test_user_key.pub key ends with "test_user@HOSTNAME" rather than test_user@192.168.1.168. But I cannot find a way to make ssh-keygen create a key-pair with the IP address rather than the HostName.
Certainly, I'll eventually have to create a key-pair with my ISP's assigned external IP address. But ...
(1) With AuthenticationMethods enabled in sshd_config I can't even get a connection established LOCALLY.
(2) With AuthenticationMethos disabled, the Windows server allows a connection without a key file even when "PubkeyAuthentication" is enabled.
(3) Why is Windows' authorized_keys empty?
Help!