私はwinhostを使用してCentOS上でPython 2.7.13経由でWindowsサーバー2012に接続しようとしています。サーバーはドメインの一部ではありません。私は別のローカル管理者アカウントを作成して接続しました。python winrmローカルアカウントを使用して接続
winrm configSDDL default
を使用して、そのユーザーにすべてのアクセスを提供します。
クライアントマシンを信頼できるホストに追加しました。
PS C:\Windows\system32> Get-Item WSMan:\localhost\Client\TrustedHosts
WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client
Type Name SourceOfValue Value
---- ---- ------------- -----
System.String TrustedHosts 172.27.150.95
ファイアウォールに例外が追加され、サービスがアップしていることを確認しました。 WinRMのため
PS C:\Windows\system32> netsh advfirewall firewall add rule name="WinRM-HTTP" dir=in localport=5985 protocol=TCP action=allow
Ok.
PS C:\Windows\system32> Get-Service -ComputerName abc -Name winrm | Select Status
Status
------
Running
PS C:\Windows\system32>
クライアント設定:
PS C:\Windows\system32> winrm get winrm/config/client
Client
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = true
Auth
Basic = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = false
DefaultPorts
HTTP = 5985
HTTPS = 5986
TrustedHosts = 172.27.150.95
Telnetが働いている:まだ
xyz:~ # telnet 172.27.148.29 5985
Trying 172.27.148.29...
Connected to abc (172.27.148.29).
Escape character is '^]'.
^]
telnet> quit
Connection closed.
xyz:~ #
しかし:また
>>> s = winrm.Session('abc', auth=('abc\script-runner', 'xxx'))
>>> r = s.run_cmd('ipconfig', ['/all'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/winrm/__init__.py", line 37, in run_cmd
shell_id = self.protocol.open_shell()
File "/usr/local/lib/python2.7/site-packages/winrm/protocol.py", line 132, in open_shell
res = self.send_message(xmltodict.unparse(req))
File "/usr/local/lib/python2.7/site-packages/winrm/protocol.py", line 207, in send_message
return self.transport.send_message(message)
File "/usr/local/lib/python2.7/site-packages/winrm/transport.py", line 190, in send_message
raise InvalidCredentialsError("the specified credentials were rejected by the server")
winrm.exceptions.InvalidCredentialsError: the specified credentials were rejected by the server
>>>
は、私が失敗/成功したログオンの監査を有効にしかし、私はどちらのfaiも見ません私の接続しようとして成功したか、成功したのか。
教えてください。足りないものは教えてください。私はローカルユーザー経由で接続したい。
あなたの援助を感謝します。