blob: 24c63057a196d88983993865bd3d503ec17e5b60 [file] [log] [blame]
Set oWshShell = CreateObject("WScript.Shell")
' create new "passwd" and "group" files for cygwin, because SID was changed
oWshShell.Run "cmd.exe /C del " & "c:\cygwin\etc\group", 0, TRUE
WScript.Sleep 1000
oWshShell.Run "cmd.exe /C del " & "c:\cygwin\etc\passwd", 0, TRUE
WScript.Sleep 1000
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\mkgroup.exe -l" & " > c:\cygwin\etc\group", 0, TRUE
WScript.Sleep 1000
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\mkpasswd.exe -l" & " > c:\cygwin\etc\passwd", 0, TRUE
WScript.Sleep 1000
' restore ownership of files
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\chown.exe root:None /etc/ssh*", 0, TRUE
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\chown.exe -R root:None /home/", 0, TRUE
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\chown.exe root:None /var/empty", 0, TRUE
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\chown.exe root:None /var/log/sshd.log", 0, TRUE
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\chown.exe root:None /var/log/lastlog", 0, TRUE
WScript.Sleep 1000
' regenerate ssh keys
' first delete old ones
oWshShell.Run "cmd.exe /C del " & "c:\cygwin\etc\ssh_host_*", 0, TRUE
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\ssh-keygen.exe -q -t rsa1 -f /etc/ssh_host_key -N " & Chr(34) & Chr(34), 0, TRUE
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\ssh-keygen.exe -q -t rsa -f /etc/ssh_host_rsa_key -N " & Chr(34) & Chr(34), 0, TRUE
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\ssh-keygen.exe -q -t dsa -f /etc/ssh_host_dsa_key -N " & Chr(34) & Chr(34), 0, TRUE
' start SSH Daemon
oWshShell.Run "cmd.exe /C " & "c:\cygwin\bin\cygrunsrv.exe -S sshd", 0, TRUE
'WScript.Sleep 1000
WScript.Quit