0

I would like to setup a passwordless SSH connection from FreeBSD (not exactly unix system, but in this context it is unix enough) to Windows 10. To do this I added OpenSSH optional feature to Windows 10 and ran the server. Confirmed with SCP command that it is possible reach it and things go through, but it asks for password. In case of unix to unix, all I have to do is copy public key from source to destination. If I do the same in case of unix to windows, source (FreeBSD) offers the public key, but without further information jumps to the next authentication method.

The key pair was generated on FreeBSD with ssh-keygen -t rsa (also tried with ssh-keygen -t ed25519, same results), then copied RSA public key to Windows 10 user's (the same user as the one used in the scp command) .ssh/authorized_keys, which is at user's home directory.

Using Putty Key Generator, I generated a public key using the private key, which was generated at source (FreeBSD). Using this format of public key in Windows user's .ssh/authorized_keys did not change anything.

I went into OpenSSH's sshd_config_default file and added the following lines:

PermitEmptyPasswords yes

PermitRootLogin yes

StrictModes no

RSAAuthentication yes

PubkeyAuthentication yes

AuthorizedKeysFile .ssh/authorized_keys

IgnoreUserKnownHosts yes

As for the syntax of this cofig file, I have no idea how it should be, but as far as I can tell I just put these lines in, like above. There are examples in the config file, but they are out-commented with #. Trying to scp with new config (server was restarted after config change) gave same results as previous tries.

How do I provide the public key, generated at FreeBSD, to Windows 10, so when I scp a file from FreeBSD to Windows 10, it does not ask for password?

3
  • Have you checked the servers' system logs in case the cause of rejection is mentioned there? – user1686 Mar 10 '20 at 13:07
  • i used scp with -v, where can I access these system logs you mention? – Kristóf Horváth Mar 10 '20 at 13:17
  • Somewhere in /var/log. Generally all sshd logs go to the same "authentication log" or "security log" file. (It doesn't matter whether you used ssh, scp, sftp, or even rsync – you're still authenticating to sshd.) If it doesn't provide enough details, set LogLevel in the server's configuration. – user1686 Mar 10 '20 at 13:27
0

I could not solve the issue with key authentication not working, but changing the way I get the file did. Instead of sending the file from FreeBSD, I pull it from Windows. For this to work, I generated keys with OpenSSH on Windows and copied public key into FreeBSD and this way it works.

(Do not forget to chmod 644 authorized_keys)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.