[openwsman] Connect Linux to Windows server

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[openwsman] Connect Linux to Windows server

lionelm
Hello;
I would like to connect and execute Powershell commands on Windows servers - from a Linux Red Hat Server.
Therefore, I installed openwsman package (RPM) , delivered with Red Hat Linux 6.5 on a Server.
Moreover,  I installed and configured WinRM on Windows Servers.

Connection does not work !

On Linux server, I launched following command :
     wsman identify -h 100.11.111.11 -P 5985 --username=windomain\winuser -p winpassword -y basic
and obtained error message :
     Connection failed. response code = 401

On Linux server, I launched following command - with debug mode :
     wsman identify -h 100.11.111.11 -P 5985 --username=windomain\winuser -p winpassword -y basic
-d 6
and obtained error message :
    Nov 20 13:59:26  cl->authentication.verify_peer: 1
    Nov 20 13:59:26  *****set post buf len = 238******
    * About to connect() to 100.11.111.11 port 5985 (#0)
    *   Trying 100.11.111.11 ... * connected
    * Connected to 100.11.111.11 (100.11.111.11 ) port 5985 (#0)
    > POST /wsman HTTP/1.1
    Host: 100.11.111.11:5985
    Accept: */*
    Content-Type: application/soap+xml;charset=UTF-8
    User-Agent: openwsman 2.2.3
    Content-Length: 238
    < HTTP/1.1 401
    < Server: Microsoft-HTTPAPI/2.0
    * gss_init_sec_context() failed: : Credentials cache file '/tmp/krb5cc_36001' not found< WWW-    Authenticate: Negotiate
    < WWW-Authenticate: Kerberos
    < Date: Thu, 20 Nov 2014 12:59:27 GMT
    < Connection: close
    < Content-Length: 0
    <
    * Closing connection #0
    Nov 20 13:59:26  Client does not support authentication type  acceptable by server
    Nov 20 13:59:26  Error = 67 (Login denied); user/password wrong or empty.
    Nov 20 13:59:26  curl error code: 67.
    Nov 20 13:59:26  cl->response_code: 401.
    Nov 20 13:59:26  cl->last_error code: 26.
    Nov 20 13:59:26  NULL response
    Connection failed. response code = 401

May you help me to establish connection from Linux to Windows server, thanks to WSMan ?

Regards
Lionel
Reply | Threaded
Open this post in threaded view
|

Re: [openwsman] Connect Linux to Windows server

Klaus Kaempf
* lionelm <[hidden email]> [Nov 20. 2014 14:04]:
> Hello;
> I would like to connect and execute Powershell commands on Windows servers -
> from a Linux Red Hat Server.
> Therefore, I installed openwsman package (RPM) , delivered with Red Hat
> Linux 6.5 on a Server.
> Moreover,  I installed and configured WinRM on Windows Servers.

Did you follow
https://github.com/Openwsman/openwsman/wiki/winrm-over-openwsman-setup ?

You need to explicitly allow unencrypted communication with basic auth.

>
> Connection does not work !
>
> On Linux server, I launched following command :
>      wsman identify -h 100.11.111.11 -P 5985 --username=windomain\winuser -p
> winpassword -y basic
> and obtained error message :
>      Connection failed. response code = 401

Remember that backslash (\) is interpreted by the shell. You either
need to use a double backslash (\\) or just the username (winuser).

>     Nov 20 13:59:26  Client does not support authentication type  acceptable
> by server

Run
  winrm set winrm/config/service/auth @{Basic="true"}
on the windows system


Btw, Windows remote shell, WinRS, is a protocol on top(!) of
WS-Management. So for execution of PowerShell commands, openwsman is
not sufficient.
There is a sample WinRS client in Ruby available at
https://github.com/Openwsman/openwsman/blob/master/bindings/ruby/tests/winrs.rb
using openwsman.
There are also a standalone WinRS implementation (not based on
openwsman) available at
https://github.com/marcanpilami/winrs
https://github.com/WinRb/WinRM


Hth,

Klaus
--
SUSE LINUX GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 21284 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel