This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Windows 7 sshd can only login as cyg_server


On 8/25/14 11:49 AM, Larry Hall (Cygwin) wrote:
On 08/25/2014 07:00 AM, Corinna Vinschen wrote:
On Aug 25 12:51, Corinna Vinschen wrote:
On Aug 22 17:24, Larry Hall (Cygwin) wrote:
On 08/22/2014 04:44 PM, Corinna Vinschen wrote:

<snip>

I solved it:

It turned out, that my Windows domain policy was updating local policies in a way, that the local cyg_server account lost his group membership to the group 'Administrators' every time I log into my Windows 7.

I have to fix that every time before I start sshd.

I wrote a little python script that does the whole thing. In case someone wants to reuse it, enjoy:

#!/usr/bin/python
# -*- coding utf-8 -*-

import win32net
import win32serviceutil

user = "cyg_server"
group = "Administrators"

# make sure sshd user is in admin group
data = [ {"domainandname" : user} ]
mem, tot, res  = win32net.NetLocalGroupGetMembers(None, group, 1)

inGroup = False
for item in mem:
    if (item['name']) == user:
        inGroup = True
        break

if not inGroup:
    win32net.NetLocalGroupAddMembers(None, "Administrators", 3, data)

# restart sshd
win32serviceutil.RestartService("sshd")



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]