Well I think Cygwin is a great tool, BUT the installation is really.. ermm.. let’s say ugly. That’s why we created a small zip file (2mb), which contains all the files you need to run a Cygwin SSH server. We created a small script, which will set up your sshd.
Be sure to edit the _install.cmd file first and enter the correct path (where to install the ssh server) and enter a password for the SSHD service which matches the password rules given on your system. Also note that this is NOT a high security installation, check the security settings yourself. And you need to edit the passwd file after the installation, to enter a correct shell (use usershell.cmd as an example) — bash is not included (and bash is in the passwd file as default)!
download neophob’s cygwin sshd package
Here is the install script::## the install directory
set INSTALL-DIR=c:ssh
:## the install directory, yes the same as above, except you need to use double backslash (\), its for the .reg file we generate
set REGINSTALL-DIR=c:\ssh
:## the password of the sshd service
set SSHDUSER-PASSWORD=pa$$word
:## used for installation, normally you dont need to change that!
set REGFILE=%INSTALL-DIR%cygmount.reg
@echo.
@echo ———————————————————————–
@echo CAUTION! READ THIS FIRST (READ IT REALLY!) — dont blame me if you dont!
@echo ———————————————————————–
@echo.
@echo this script will install cygwin ssh server (or sshd). this script will:
@echo –create a local user called sshd_server
@echo –create a service called sshdNEO (display name: CYGWIN sshd NEOPHOB.COM)
@echo.
@echo be sure that:
@echo –you are logged in as a administrator
@echo –you didnt allready use cygwin — else your installation will be unusable!
@echo –this machine is not a domain controller — this will not work
@echo (dc’s dont have local user’s)
@echo –this is just a quick hack, check the security setting on your own!
@echo –you edited or reviewed the first lines of this script (install directories)
@echo –you know what you’re doing.
@echo.
@echo Comments or hints to: admin@neophob.com — http://www.neophob.com
@echo.
@echo.
@echo Press Ctrl + C to abort now.
@echo.
pause
echo REGEDIT4 > %REGFILE%
echo [HKEY_LOCAL_MACHINESOFTWARECygnus SolutionsCygwinmounts v2]» %REGFILE%
echo “cygdrive prefix”=”/cygdrive”» %REGFILE%
echo “cygdrive flags”=dword:00000022» %REGFILE%
echo [HKEY_LOCAL_MACHINESOFTWARECygnus SolutionsCygwinmounts v2/]» %REGFILE%
echo “native”=”%REGINSTALL-DIR%”» %REGFILE%
echo “flags”=dword:0000000a» %REGFILE%
regedit %REGFILE%
echo # generate ssh keys…
ssh-keygen –t rsa1 –f .etcssh_host_key –N ”
ssh-keygen –t rsa –f .etcssh_host_rsa_key –N ”
ssh-keygen –t dsa –f .etcssh_host_dsa_key –N ”
echo # add local user sshd_server…
net user sshd_server %SSHDUSER-PASSWORD% /add /fullname:“sshd server account” /EXPIRES:NEVER /yes
echo # add sshd_server user to admin group…
net localgroup Administrators sshd_server /add
echo # generate passwd file from local users…
mkpasswd.exe –l » .etcpasswd
echo # grant sshd_server account user rights…
editrights –a SeAssignPrimaryTokenPrivilege –u sshd_server
editrights –a SeCreateTokenPrivilege –u sshd_server
editrights –a SeDenyInteractiveLogonRight –u sshd_server
editrights –a SeDenyNetworkLogonRight –u sshd_server
editrights –a SeDenyRemoteInteractiveLogonRight –u sshd_server
editrights –a SeIncreaseQuotaPrivilege –u sshd_server
editrights –a SeServiceLogonRight –u sshd_server
echo # install service sshdNEO
cygrunsrv –I sshdNEO –d “CYGWIN sshd NEOPHOB.COM” –p /sshd –a –D –u sshd_server –w %SSHDUSER-PASSWORD% –e “CYGWIN=ntsec”
echo # fix some security settings…
chown sshd_server /etc/ssh*
chown sshd_server /var/log/empty
chown sshd_server /var/log/ssh*.log
chmod 700 /etc/ssh*
chmod 770 /var/log/*
echo # in the file /etc/passwd, change the line from:
echo “# Administrator:..<skipped>..:/home/Administrator:/bin/bash“
echo # to:
echo “# Administrator:..<skipped>..:/home/Administrator:/usershell.cmd”
notepad %INSTALL-DIR%etcpasswd
3 Comments
1 mystic wrote:
Im having the issue noted @ the following link. Any idea on how to fix it?
http://msgs.securepoint.com/cgi-bin/get/openssh-unix-dev-0607/8.html
–Thanks
2 Corinna Vinschen wrote:
Hi,
your minimal ssh package offer violates the GPL, because you don’t
offer the source codes as well. Please note that it’s not sufficient
to post the URL to http://cygwin.com, you have to provide the source
yourself, and the sources must provide the exact same releases as
have been used to create the binary package from.
AFAICS from the package, you should prepare a source package
contain the matching releases of
- Cygwin
– editrights
– coreutils
– libiconv
– gettext
– minires
– zlib
Providing the sources for the following packages is not necessary
since they aren’t licensed under the GPL, but it would be nice to
do it nevertheless as a courtesy to the users:
- OpenSSH
– OpenSSL
Btw., the installation using Cygwin’s setup.exe and running the
ssh-host-config script afterwards looks much easier to me, but
perhaps I’m just biased.
Thanks,
Corinna Vinschen
Cygwin Project Co-Leader
3 Thomas wrote:
Hi,
I really like this package, but what is the username to user for the ssh connection?
Best regards Thomas