• Forword: ssh server for windows


    c

    The canonical URL of this page should be  http://pigtail.net/LRP/printsrv/cygwin-sshd.htm


    This page has been tranlated to Bulgarian by Albert Ward, see this link: http://www.fatcow.com/edu/cygwin-sshd-bl/

    Disclaimer

    According to some cygwin gods, the only official document that you should use is  /usr/share/doc/Cygwin/openssh.README which is probably valid, but it seems to aim at users with a fair bit of Linux/Unix knowledge.
    The purpose of this tutorial is for Windows users who are perhaps less familiar with Unix commands wanting to try out the famous Open Source ssh server (openSSH) on a desktop Windows XP , Windows Vista or Windows 7  .

    The behavior of Windows 2003 Server is different. Follow this link to install OpenSSH on Windows 2003 Server, by Stephen Pillinger of the School of Computer Science, University of Birmingham. Or this link to install Cygwin SSH server on Windows 2003 Server, by  Kevin Scully at the University of Waterloo, Ontario, Canada.

    There seems to be some problems when using cygwin ssh with McAfee 8.0i. A work around to that problem is available below.

    Please don't send any questions to the cygwin mailing list to ask questions about this page as it seems to provoke them severely. They considered and declared the instructions on this page "broken" and "random" but won't constructively say what is "broken"; instead some went on launching personal attacks. The information here is provided "as is, in good faith" with no guarantee it will work. If it doesn't work, then it doesn't work. Don't send any questions to the Cygwin mailing list to ask why to provoke them. If you must go to Cygwin mailing list to ask, you better off completely remove Cygwin before you go to the mailing list to ask questions and don't even mention that you have looked at this web page (to avoid provoking them off).

    Read this Disclaimer

    Constructive comments are of course welcome, in the original spirit of the Internet, sharing experience and knowledge regarding bug fixes and improvements to benefit other users of the Internet community. My email address is


    cygwin-openssh   

    How to install a ssh server (called sshd, from OpenSSH) on a Windows 2000 or XP
    How to install a sftp server on a Windows 2000 or XP


    If you need a PDF converter, the post powerful pdf converter package available is Investintech's pdf server software bundle.

    g
    After you installed OpenSSH, you will find it simple to install application software on your Windows XP/Vista that will effectively turn your PC into a complete security camera system. Install security cameras into the back of your computer and you will have the ability to remotely access your security system over a network or Internet.

    The ssh server is an emulation of the UNIX environment and OpenSSH for Windows, by Redhat, called cygwin.
    The file system on your target machine should be journalled (e.g. NTFS) because FAT file system has bugs in file access.

    (1a) Login as Administrator
    Windows XP - login as a user with Administrator privilege;
    Windows 2003 Server: login as local admin, it will not work for domain users or domain admin.

    (1b) Make sure the current admin/user has a Windows password set.
    If not, use g Control Panel...User Accounts to create a password.
    Just to be on the safe side, after you created a password, logoff and then log in again.

    (2a) Create a folder c:\cygwin

    (2b) g Download cygwin's setup.exe from http://www.cygwin.com/ and save setup.exe in c:\cygwin

    Cygwin's setup.exe has some uncommon properties, click here to find out more.

    (2c) For Windows 7 and Windows Vista, navigate to c:\cygwin in explorer,  right click the setup.exe icon, and select "Run as Administrator". Thanks to David Shanks for his contributions.

    (2d) For Windows XP: Click Start...Run...and type c:\cygwin\setup.exe

    If you are asked to select "Just Me" or "All Users", choose "All Users"

    When it asks for "Local Package Directory", type c:\cygwin

    Choose a download site that is "close" to you.
    When a selection screen comes up (you can resize the windows to see better),
    click the little View button for "Full" view  g,
    find the package "openssh", click on the word "skip" so that an x appears in Column B,
    see this illustration.
    (optional) find the package "tcp_wrappers", click on the word "skip" so that an x appears in Column B,
    if you add "tcp_wrapper", you will most likely get "ssh-exchange-identification: Connectiion closed by remote host" error.
    If you get that error, edit the file  /etc/hosts.allow and add these two lines
    ALL: 127.0.0.1/32 : allow  
    ALL: [::1]/128: allow
    before the PARANOID line.
    (optional) find the package "diffutils", click on the word "skip" so that an x appears in Column B, 
    find the package "zlib", click on the word "skip" (it should be already selected) so that an x appears in Column B.

    Notes:
    tcp_wrappers provides host-based access control and possible need you to edit "/etc/hosts.allow" 
    zlib is the compression and decompression library that is used by many programs.
    Thanks to Lex Sheehan on the diffutils tips, and Thomas Braun for the hosts.allow tips.

    Click next to start installing cygwin and ssh.
    Size of the basic cygwin system is more than 50 Meg, this may take a while.

    Take a coffee break and wait.g

    SherWeb
    While you wait, take a look at SherWeb's Exchange server hosting.

    (3) This paragraph is no longer valid for newer versions of Cygwin 1.7.2 and later.
    REF:  http://www.cygwin.com/cygwin-ug-net/ov-new1.7.html
    Right click My Computer, Properties, Advanced, Environment Variables
    See this illustration (red dots)
    Click the "New" new button to add a new entry to System variables:
    variable name is CYGWIN
    variable value is ntsec tty

    Note: by setting variable ntsec, it will break sshd on MinGW by generating the error "WARNING: UNPROTECTED PRIVATE KEY FILE".
    Thanks to Peter Rust for this issue.

    (4) Right click My Computer, Properties, Advanced, Environment Variables
    See this illustration (green dots)
    Select the Path variable and click the "Edit" edit button:
    append  ;c:\cygwin\bin   to the end of the existing variable string.

    (5) 

    For Windows 7 and Windows Vista  you may need to do additional uninstall steps if previous attempts to install sshd fails.
    Click here on how to do clean uninstall.

    For Windwos XP, you should login as a user with admin privilege and that user belongs to a Windows "Users" group.

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

    With recent releases of cygwin, there are many permission problems. Add these 6 commands as work around:

    chmod +r  /etc/passwd
    chmod u+w /etc/passwd
    chmod +r  /etc/group
    chmod u+w /etc/group
    chmod  755  /var  
    touch /var/log/sshd.log
    chmod 664 /var/log/sshd.log


    ssh-host-config    (manuall answer Yes to questions except)
    If the script says "This script plans to use cyg_server, Do you want to use a different name?  Answer Yes, and type sshd as the user name.

    cyglsa-config

    reboot the computer.

    Thanks to David Spillett of Londdon, UK on the permission tips.
    Thanks to Dave Lennert of Portland Oregon for the WIndows 7 tips.
    Thanks to Frank Martin for the cyglsa-config tips.

    When the script stops and asks you for "environment variable CYGWIN="     your answer is ntsec tty 
    (click here for an explanation of ntsec)
    (click here for an explanation of tty )
    (thanks to Peter Reutemann of New Zealand and Ron Dozier of University of Delaware)
    (thanks to Mike and Michael Pechner for the Windows Vista tip)
    (thanks to Kevin Hilton on the Vista tips in the ssh-host-config section)

    See Note 25 near the end of this web page if you need to run ssh-host-config again.

    Run "rebaseall" as desribed in http://www.acooke.org/cute/CygwinSSHS0.html

    (6) While you are still in the (black) cygwin screen, start the sshd service, type
    net start sshd
    or
    cygrunsrv  --start  sshd

    Click here on how to stop the sshd service.

    If the service fails to start, try (thanks to Ross Beveridge of HP for this tip)
    chown system /etc/ssh*
    chown system /var/empty  or chown sshd_server /var/empty
    net start sshd

    If you get "ssh-exchange-identification: Connectiion closed by remote host" error.
    edit the file  /etc/hosts.allow and add these two lines
    ALL: 127.0.0.1/32 : allow  
    ALL: [::1]/128: allow
    before the PARANOID line. Thanks to Thomas Braun for the hosts.allow tips.

    (7)
    Make sure every Windows user has a password set, if not, 
    go to g Control Panel....User Accounts and create a password.

    (7a) Make sure every Windows user has done the following at least once:
    Login in as the Windows user, pop a console command screen by clicking Start...Run....cmd
    Thanks to Magno Corrêa of Brazil for the tip in (7a)

    (8) important Pop a cygwin gwindow, harmonize Windows user information with cygwin, otherwise they cannot login
    mkpasswd   -cl   >   /etc/passwd
    mkgroup   --local    >   /etc/group

    If your XP logs on to a domain, you most likely have to manually edit /etc/group. See this page.

    If  your local account name is the same as the domain name, then you would need to use Windows's User admin function to
    rename the loacal account from name to name.local
    Then rebuild the passwd and group files as shown above, then edit the /etc/group file as shown above. Open firewall's TCP port 22
     
    (Thanks to Christopher Poda of Venturi Wireless, Sunnyvale, California)

    If your XP logs on to a domain, you may want to edit /etc/passwd to replace /home/username by //unc_server/path_to_home 
    (thanks to Geoff Thomas)

    mkpasswd creates a password file from Windows' user list, click here for more details.
    mkgroup creates a group file from Windows' user list, click here for more details.
    Thanks to John Skiggn of Cingular Wireless in Redmond, Washington for his tweak on domain user /etc/group


    Test to see if sshd is working, pop a cygwin gwindow (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)

    g 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)

    Error is also related to /etc/hosts.allow file, see http://www.cygwin.com/ml/cygwin/2008-12/msg00678.html

    g 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
    lsc

    if you see a directory listing, success! g g g
    (type exit to end the cygwin ssh session)  
    Thanks to Roger Pack for his tips clarifying between Microsoft's ls.exe (installed by MS compilers) and cygwin's ls.exe

    If you have a Windows username that contains space, expand the space into \ [space],
    e.g. if the Windows login name is  Mickey mouse
    ssh  Mickey\  mouse@127.0.0.1

    If you have a Unix system that does not know what to do with TERM cygwin, add these scripts to .login

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

  • 相关阅读:
    MVC CONTROLS TOOLKIT
    activemq Example
    OWASP
    ActiveMQ持久化消息的三种方式
    sqlyog
    dotnet压缩
    asp.net ajax 环境 c#与js互调
    asp.net 初步入门使用正则抓取网页信息
    用ASP.NET with C# 绘制曲线图(Curve图)转
    asp.net 中使用excel组件权限设置
  • 原文地址:https://www.cnblogs.com/zhyg6516/p/2252382.html
Copyright © 2020-2023  润新知