Search A-Z index Help
University of Cambridge Home Physics Dept Home Mike Roses' Home Page TCM Group Home

Cygwin Command line install

We like cygwin sshd to be running on windows computers so we can reboot them remotely (at least so that startup scripts run if changed for registry hacking) and to issue remote commands. A command line install of cygwin packages helps a LOT:

cmd /c mkdir %SystemDrive%\cygwin

cmd /c xcopy /I /y /S \\SERVER\netlogon\cygwin\Cygwin-Root %SystemDrive%\cygwin\

\\SERVER\netlogon\cygwin\setup.exe -q -R %SystemDrive%\cygwin -p openssh,openssl,cygrunsrv,rebase,tcltk,vim

%SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin cygrunsrv -R sshd'

REM /bin/ash is the right shell for this command
cmd /c %SystemDrive%\cygwin\bin\ash -c /bin/rebaseall

cmd /c %SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin mkgroup -l'>%SystemDrive%\cygwin\etc\group

cmd /c %SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin mkpasswd -l'>%SystemDrive%\cygwin\etc\passwd

%SystemDrive%\cygwin\sleep.exe 1

%SystemDrive%\cygwin\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/ssh-host-config -y -c "ntsecbinmode tty" '

%SystemDrive%\cygwin\sleep.exe 2 

cmd /c if exist %Systemroot%\system32\netsh.exe netsh firewall set allowedprogram %SystemDrive%\cygwin\usr\sbin\sshd.exe SSHD enable

%SystemDrive%\cygwin\sleep.exe 2

net start sshd


The files in cygwin\Cygwin-Root\ are:







Hacks to Cygwin setup.exe by Frank Lee ( to get it to accept the -p argument for a package listing.

Compiled version of hacked Cygwin setup.exe that makes this possible.