I am trying to login to Windows without password from a Linux server. I have already installed OpenSSH from GitHub and I'm able to do scp
and ssh
. I tried copying the authorized_keys
to the Windows location. But it's still not working.
The functionality should be no password prompt for running ssh or scp from linux environment to login/show windows directory.
I tried below commands:
cat .ssh/id_rsa.pub | ssh edh_win@xxx.xxx.xxx.xxx 'cat >> .ssh/authorized_keys'
ssh edh_win@xxx.xxx.xxx.xxx "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
But getting error not able to understand cat
and chmod
.
Updating the errors
'cat' is not recognized as an internal or external command,
operable program or batch file.
'chmod' is not recognized as an internal or external command,
operable program or batch file.
Do I need to install cygwin? If yes, please help with the implementation.
Any assistance is appreciated. Below is an image of the error.
Best Answer
Steps to establish passwordless SSH between Linux ⬌ Windows:
Note:
C:\Windows\System32\OpenSSH
orC:\Program Files\OpenSSH
to the SystemPath
Windows Server 2019:
Windows Server 2012 and 2016:
OpenSSH-Win64.zip
)C:\Program Files\OpenSSH
and enter directoryFollow steps 4 - 6 mentioned in the Install Wiki:
Common Steps for Windows Server 2012/2016/2019:
Execute the following, which should show the status as
Running
for both services:If not running: open Services and start
OpenSSH Server
andOpenSSH Authentication Agent
ssh-keygen
and follow the promptsC:\ProgramData\ssh\administrators_authorized_keys
:/root/.ssh/id_rsa.pub
toC:\ProgramData\ssh\administrators_authorized_keys
id_rsa.pub
does not exist on Linux, generate via:ssh-keygen
C:\Users\Administrator\.ssh\id_rsa.pub
to/root/.ssh/authorized_keys
authorized_keys
does not exist:For permission settings:
Relevant locations on Windows host:
C:\Windows\Sytem32\OpenSSH\
C:\Program Files\OpenSSH\
C:\Users\Administrator\.ssh\
C:\ProgramData\ssh\
References: