Thu, 10 Aug 2006
cygwin + ssh
Download and install cygwin to c:\cygwin. Select the packages that make sense, but make sure to include cygrunsrv and openssh packages. Right click 'My Computer' and under Environment Variables of the Advanced tab, in the section System variables, add 'CYGWIN' for variable, and 'ntsec tty' for value. Also add on to the end of the PATH variable the following: 'c:\cygwin\bin'. Edit c:\cygwin\cygwin.bat. Make sure it contains these lines - you will need to add the line setting the CYGWIN environment variable. @echo off set CYGWIN=binmode tty ntsec C: chdir \cygwin\bin bash --login -i Test cygwin to make sure it works. ls /bin // to see the cygwin bin directory dir c: // to see the contents of the C: directory Type "control d" or 'logout' to exit the shell. If you get a message saying 'cannot create /home/userid', run this command from the cygwin window "mkpasswd -l >/etc/passwd". Run ssh-host-config to set up the ssh host keys and create the sshd_config file in /etc/. You should see output like this: $ ssh-host-config Generating /etc/ssh_host_key Generating /etc/ssh_host_rsa_key Generating /etc/ssh_host_dsa_key Generating /etc/ssh_config file Generating /etc/sshd_config file Added ssh to /cygdrive/c/WINNT/system32/drivers/etc/services Do you want to install sshd as service? (Say "no" if it's already installed as service) (yes/no) Answer 'yes' to the prompt. Press 'Return' to accept the default at the CYGWIN environment question (default = binmode tty ntsec). The service name is CYGWIN sshd. Type 'cd' to go to your account's home directory. Run ssh-user-config to setup your ssh keys. Create only an SSH2 RSA identity (use a null passphrase - just press return). Output should be similar to this : $ ssh-user-config Shall I create an SSH1 RSA identity file for you? (yes/no) no Shall I create an SSH2 RSA identity file for you? (yes/no) (yes/no) yes Generating /home/pswander/.ssh/id_rsa Enter passphrase (empty for no passphrase): Enter same passphrase again: Do you want to use this identity to login to this machine? (yes/no) yes Shall I create an SSH2 DSA identity file for you? (yes/no) (yes/no) no You will probably want to change permissions and ownership on some files: cd /; chmod -R og-w . // note the period chmod og+w /tmp touch /var/log/sshd.log // may already be there chown SYSTEM:SYSTEM /var/log/sshd.log chown SYSTEM:SYSTEM /var/empty chown SYSTEM:SYSTEM /etc/ssh_h* chmod 755 /var/empty At the prompt type the following to install sshd as a service: cygrunsrv -I sshd -p /usr/sbin/sshd -a '-D' -d 'CYGWIN sshd' And then the following to start the service: cygrunsrv -S sshd And then test it with: ssh localhost And then test it from another machine. And if necessary, the following to remove the service cygrunsrv -R sshd There is also more documentation at /usr/doc/Cygwin.
Posted at: 21:36 | category: /configure | Comments ()
Rustybear Blog