Skip to content

Instantly share code, notes, and snippets.

@gswallow
Created October 2, 2013 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gswallow/6798859 to your computer and use it in GitHub Desktop.
Save gswallow/6798859 to your computer and use it in GitHub Desktop.
@echo off
REM http://webcache.googleusercontent.com/search?q=cache:SjoPPpuQxuoJ:www.tcm.phy.cam.ac.uk/~mr349/cygwin_install.html+install+cygwin+ssh+commandline&cd=2&hl=nl&ct=clnk&gl=be&source=www.google.be
cmd /c powershell.exe -command "$webClient = New-Object System.Net.WebClient ; $webClient.DownloadFile('http://cygwin.com/setup-x86_64.exe', $env:TEMP + '/cygwin-setup-x86_64.exe')"
REM go to a temp directory
cd %TEMP%
REM run the installation
cmd /c cygwin-setup-x86_64.exe -N -n -q -P openssh,openssl,cygrunsrv,rebase,libintl8,libiconv2,libcygncursesw -s http://cygwin.mirrors.pair.com
REM clear out straggler SSH daemons
%SystemDrive%\cygwin64\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin cygrunsrv -R sshd'
REM rebase all packages, whatever that is.
cmd /c %SystemDrive%\cygwin64\bin\ash -c '/usr/bin/rebaseall'
REM create /etc/passwd and /etc/group files
cmd /c %SystemDrive%\cygwin64\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin mkgroup -l'>%SystemDrive%\cygwin64\etc\group
cmd /c %SystemDrive%\cygwin64\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin mkpasswd -l'>%SystemDrive%\cygwin64\etc\passwd
REM set up sshd service
%SystemDrive%\cygwin64\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/ssh-host-config -y -c "binmode" -w "LQRaLgwJvks2!?"'
REM configure cyglsa -- should not be necessary
REM %SystemDrive%\cygwin64\bin\bash -c 'PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/cyglsa-config -y'
REM enable firewall
cmd /c netsh advfirewall firewall add rule name="SSH" protocol=TCP dir=in localport=22 action=allow enable=yes
net start sshd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment