Re: Issue running PowerShell code on Windows Machine from Linux machine using Cygwin
- Date: Mon, 30 Jul 2018 19:30:53 +0200
- From: john doe <johndoe65534@xxxxxxxx>
- Subject: Re: Issue running PowerShell code on Windows Machine from Linux machine using Cygwin
On 7/30/2018 1:20 PM, Shekhar Shukla wrote:
I am having issue while establishing a ssh connection from Linux to Windows
machine using Cygwin. My powershell script works when I run it from Linux
using ssh connection(Cygwin) to Windows and manually enter my passowrd.
But whn I use public key to authenticate my user(making a password less
connection), it fails. Is it a bug with CYgwin?
Below is the step by step explantion-
I have put on Windows machine. This machine has Cygwin installed on it
echo "Hello World!"
get-adcomputer -Filter * |select Name|select -first 10
2. When I run
from Linux machine using Cygwin WITHOUT enabling password-less connection,
It asks for password
of Windows machine and after entering the password it
like a charm. See below-
shekhar@LinuxBox:~$ ssh shekhar@xxxxxxxxxxxxxxxxxxxxx 'powershell
3. Now I generate an ssh-key on Linux for user shekhar and copy it on
Windows machine to make a password less connection.
shekhar@LinuxBox:~$ ssh-copy-id shekhar@xxxxxxxxxxxxxxxxxxxxx
Now try logging into the machine, with "ssh 'shekhar@xxxxxxxxxxxxxxxxxxxxx'",
and check in:
to make sure we haven't added extra keys that you weren't expecting.
4. Now I run the same script again. Now it doesn't asks a password makes a
connection with Windows box and display Hello world(first line of code) but
fails on the second line
shekhar@LinuxBox:~$ ssh shekhar@xxxxxxxxxxxxxxxxxxxx 'powershell
WARNING: Error initializing default drive: 'Unable to contact the server.
may be because this server does not exist, it is currently down, or it does
have the Active Directory Web Services running.'.
Get-ADComputer : Unable to contact the server. This may be because this
does not exist, it is currently down, or it does not have the Active
Web Services running.
At C:\scripts\abc.ps1:3 char:15
+ get-adcomputer <<<< -Filter * |select Name|select -first 10
+ CategoryInfo : ResourceUnavailable: (:) [Get-ADComputer],
+ FullyQualifiedErrorId : Unable to contact the server. This may be
e this server does not exist, it is currently down, or it does not have
e Active Directory Web Services running.,Microsoft.ActiveDirectory.Managem
In ~/.ssh/authorized_keys you could try those options:
NO-PTY,NO-USER-RC ssh ...
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple