Open neoanantha opened 4 years ago
I have recently encountered the same behavior while creating Packer images using the same OS for AWS. The user data I supply configures SSH similar to what you have done. I recieve permission denied but if I interactively log in as Administrator, ssh is immediately available.
My resolution was simply to wait. Whatever was accomplished by my logon eventually occurs regardless and I can successfully connect via ssh.
Thanks for sharing your experience @subflow22
It was an internal automation setup.
Hence loaded up username and password plaintext into registry to automatic login for now as it was a sandbox testbed without access to external network
SSH is working fine and that is doing the job for now
Testbed is under continuous use now. Will try your solution when it becomes free and revert back here with results
"OpenSSH for Windows" version OpenSSH_8.1p1 for Windows
Server OperatingSystem Windows Server 2016
Client OperatingSystem CentOS Linux release 7.7.1908 (Core) Linux 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
What is failing ssh connection to OpenSSH Server running on Windows Server 2016 from Linux is failing until user logs into the Windows Server once through the user being used for ssh connection
Steps to reproduce Enable pubkey auth from CentOS 7 client machine to OpenSSH server Windows Server 2016
The user is "adminuser" which is part of administrators group on Windows Server 2016 and it's auth...keys is located at C:\Users\adminuser.ssh\authorized_keys
Windows Server goes for a restart. Once Windows server reboots and shows login screen, DO NOT login into windows using adminuser
Go back to linux shell and attempt to do plain ssh "ssh adminuser@windowsserver" from CentOS7 client machine
Moving authorized_keys to some other location like C:\openssh.ssh did not help either, of course the path was updated accordingly in c:\programdata\ssh\sshd_config, which this step was attempted
btw this machine is part of AD
Expected output ssh connection should get established
Actual output ssh connection fails with permission denied
Success scenario Login into Windows 2016 system through the login screen using "adminuser"
Come back to CentOS7 client machine and run the "ssh adminuser@windowsserver"
Immediately ssh connection gets established successfully
Logs when adminuser is not logged into Windows Server 2016-ssh failed
Logs after adminuser logged into Windows Server 2016 through windows console
Eventhough we are using Win32-OpenSSH with ansible, issue and resolution mentioned in this link was not applicable in my case
https://github.com/ansible/ansible/issues/62730
Steps which solved the issue in above ansible issue was tried but didn't help in resolving the problem