2008年7月13日 星期日

Install sshd for cygwin

  • For Windows XP , open a cygwin window by double clicking the icon; a black screen pops open,
  • For Windows Vista , right click the icon and choose "run as administrator"; a black screen pops open, type

  • ssh-host-config -y (on slower computers, it may take several minutes to generate the dsa security keys)
    If the script asks you about "privilege separation", answer yes
    If the script asks about "create a local user sshd on this machine", answer yes
    If the script asks you about "install sshd as a service", answer yes

  • Windows Vista
    If Vista asks "create a new local account ssh_server which has the required privileges" answer yes

  • When the script stops and asks you for "environment variable CYGWIN=" your answer is ntsec or tty
    (click here for an explanation of ntsec)

  • Start sshd
    net start sshd
    or
    cygrunsrv --start sshd

  • Stop sshd
    net stop ssh
    or
    cygrunsrv --stop sshd

  • If the service fails to start, try
    chown system /etc/ssh*
    chown system /var/empty
    net start sshd

  • Important Pop a cygwin window, harmonize Windows user information with cygwin, otherwise they cannot login
    After you created (or removed) Windows users
    mkpasswd -cl > /etc/passwd
    mkgroup --local > /etc/group

    mkpasswd creates a password file from Windows' user list
    mkgroup creates a group file from Windows' user list

  • Test to see if sshd is working, pop a cygwin window (note: the command below is case sensitive)
    whoami
    ssh localhost

    or
    ssh -vvv localhost
    or
    ssh $USERNAME@127.0.0.1

  • if ssh complains "The authenticity of host xx.xx.xx.xx can't be established .... Are you sure you want to continue connecting (yes/no)?" Answer yes (Thanks to Daniel Griscom of Suitable Systems)
  • If you get an error message like "ssh-exchange-identification: Connection closed by remote host", it is probably caused by McAfee 8.0i, see this page about the fix. (Thanks to Ron Dozier of University of Delaware, USA)
  • If you get an error message like "entry point _getreent", or "QuerryService Status: Win32 error 1062", it is probably caused by the existance of an older version of "cygwin1.dll" located in the search path. Do a full serarch of "cygwin1.dll" and remove the old version, except the current version at c:\cygwin\bin (Thanks to Joe britton)

  • If you get a prompt without error messages, type
    cd /cygdrive/c
    if you see a directory listing, success!

    If you have troubles ssh into the server, try run ssh-user-config

以上資料轉載自 http://pigtail.net/LRP/printsrv/cygwin-sshd.html

沒有留言: