Results 1 to 7 of 7

Thread: Tutorial: Installing cygwin and openssh on Windows and setting up an OpenSSH server.

  1. #1
    Will YOU be ready when the zombies rise? x88x's Avatar
    Join Date
    Oct 2008
    Location
    MD, USA
    Posts
    6,334

    Default Tutorial: Installing cygwin and openssh on Windows and setting up an OpenSSH server.

    This was requested, so here ya go. I hope it helps.

    I did this on XP since that was the first VM I grabbed that actually had a snapshot without it installed, but these instructions should work the same on any version of Windows.


    "Cygwin is a Linux-like environment for Windows"
    This official statement of purpose sums it up pretty nicely. The upshot of this is that a lot of Linux CLI utilities can be fairly easily installed and used in Windows.

    Installing cygwin is a bit more complicated than a normal program, but it's a lot more versatile as well. You see, the cygwin installer is more than just an installer. It is the package manager for all the applications available for the cygwin environment.


    Note before install in case you normally install things to unusual places:
    The default cygwin install, including the packages I add in this guide, come to a grand total of 135MB. So, unless you are severely lacking disk space, I would recommend installing this to the same drive as your OS.

    To install cygwin:

    1) Download the cygwin program.

    Because the program is the package manager and updater as well as the installer, you probably want to keep it around. The next step is optional and is just my personaly prefered way of doing this.

    2) Run the program and advance to the 'Select Connection Type' screen, changing any options along the way. At this point the directory structure will be created (default is C:\cygwin). At this point, cancel the installation process, delete the setup log files that it created in the directory that the exe is currently in, and move the exe to the cygwin directory.


    3) Run the program again and continue through the install.

    4) At the 'Choose Download Site(s)' screen, pick whichever mirror(s) you like. I've found that the xmission servers usually give really fast
    connections, so I select those two.


    5) At the 'Select Packages' screen you begin to see the true function of this program, not simply as an installer, but as a package manager. You can browse packages using a number of different views (switchable using the 'View' button in the top right of the window). I prefer 'full' to 'category', as it makes it easier to find something I am specifically looking for. To select a package for install, click where it says 'skip' to select it for install.



    6) You will want to select the following packages to create an OpenSSH server:
    binutils
    openssh


    I would also recommend installing a CLI text editor, just on general principles. I prefer nano, but many others are available including vim and emacs.

    Dependencies are resolved automatically at the next screen.


    7) Wait for the packages to be downloaded and installed. This may take quite a while depending on your internet connection speed. Go get a sandwich or something.

    The last thing you have to do in the cygwin installer is select where you want shortcuts. This is fairly straightforward and normal, but I feel I should point something out. The shortcuts that cygwin creates open a custom shell that is a bit more Linux-like than normal Windows CLI (tab-completion works correctly, a lot of the familiar hotkeys work, etc). This can be launched manually by running the 'cygwin.bat' file in the cygwin directory (in fact, this is what the shortcut does), but I have found that if I try and 'pin' the shortcut in Windows 7 it just launches the normal Windows CLI. XP appears to not have this bug for adding the shortcut the quick-launch list and it might have been fixed since I installed (I haven't actually updated it on my system for months).

    We're almost done. The next few steps are not strictly necessary, but I like to do them to make for a more seamless experience, allowing you to use cygwin utilities from the normal Windows CLI in addition to through the cygwin shell.

    9) Open 'System Properties' (right-click 'My Computer' and select 'Properties').

    10) Select the 'Advanced' tab.

    11) Select the 'Environment Variables' tab.

    12) Select the 'Path' variable and select the 'Edit' button.

    13) In the 'Variable value' field, add ";C:\cygwin\bin" to the end (minus the quotes). If you installed in a different directory, of course change "C:\cygwin" to whatever you used instead.


    14) Select 'Ok' in all windows.



    Now all the software is installed, we just need to set up the SSH server.



    To configure the OpenSSH server:

    1) Open a cygwin shell.

    2) Run:
    Code:
    ssh-host-config
    -Unless you specifically know you want them to be something different, answer 'yes' to all questions.

    -When it asks: "Do you want to install sshd as a service?", if you answer yes then it will start sshd on boot every time. If you answer no, you can always start it manually.

    -If it asks "Enter the value of CYGWIN for the daemon", you can leave that blank and just hit enter/return/whateveryourliketocallit.



    -The config script tells you this at the end, but to reiterate, the ssh server can be started using either of these commands, or, if you chose to install sshd as a service, it will also start on the next reboot.
    Code:
    net start sshd
    cygrunsrv -S sshd
    From here you can do any configuration that you want as you would on any Linux system.



    A couple notes:
    -In the cygwin shell, "/" is the cygwin install directory ("C:\cygwin" in my case), and any system drives can be accessed in the "/cygdrive/" directory.

    -User accounts and passwords are stored by cygwin separately from Windows, but are copied over the first time you open a cygwin shell. They can also be copied over at any point in the future using the command below. NOTE: This will overwrite any changes you have made to cygwin user accounts and passwords.
    Code:
    mkpasswd -l > /etc/passwd
    So, as the ssh config said, Have fun! If you have any questions or I didn't explain something well enough, just ask.
    That we enjoy great advantages from the inventions of others, we should be glad of an opportunity to serve others by any invention of ours, and this we should do freely and generously.
    --Benjamin Franklin
    TBCS 5TB Club :: coilgun :: bench PSU :: mightyMite :: Zeus :: E15 Magna EV

  2. #2
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Tutorial: Installing cygwin and openssh on Windows and setting up an OpenSSH serv

    Thanks! I'm trying it now!

    [edit] SEEMS TO BE WORKING!!!!
    Last edited by Trace; 09-30-2010 at 10:58 PM.
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

  3. #3
    Will YOU be ready when the zombies rise? x88x's Avatar
    Join Date
    Oct 2008
    Location
    MD, USA
    Posts
    6,334

    Default Re: Tutorial: Installing cygwin and openssh on Windows and setting up an OpenSSH serv

    One thing I forgot until just now...I think if you do not have a password set for an account it might get confused when you try to SSH in...or that might have been Ubuntu...
    That we enjoy great advantages from the inventions of others, we should be glad of an opportunity to serve others by any invention of ours, and this we should do freely and generously.
    --Benjamin Franklin
    TBCS 5TB Club :: coilgun :: bench PSU :: mightyMite :: Zeus :: E15 Magna EV

  4. #4
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Tutorial: Installing cygwin and openssh on Windows and setting up an OpenSSH serv

    How do i make an account interactive.
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

  5. #5
    Will YOU be ready when the zombies rise? x88x's Avatar
    Join Date
    Oct 2008
    Location
    MD, USA
    Posts
    6,334

    Default Re: Tutorial: Installing cygwin and openssh on Windows and setting up an OpenSSH serv

    Sorry, I'm not getting your meaning.
    That we enjoy great advantages from the inventions of others, we should be glad of an opportunity to serve others by any invention of ours, and this we should do freely and generously.
    --Benjamin Franklin
    TBCS 5TB Club :: coilgun :: bench PSU :: mightyMite :: Zeus :: E15 Magna EV

  6. #6
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Tutorial: Installing cygwin and openssh on Windows and setting up an OpenSSH serv

    The Putty window closes immediately upon login. It seems I need an "Interactive User" so my window doesn't close.
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

  7. #7
    Will YOU be ready when the zombies rise? x88x's Avatar
    Join Date
    Oct 2008
    Location
    MD, USA
    Posts
    6,334

    Default Re: Tutorial: Installing cygwin and openssh on Windows and setting up an OpenSSH serv

    Well, according to Microsoft, an interactive user is just a user that's logged in on the system that a COM server is running; ie, the computer running cygwin in this case, which you're obviously going to be if you can actually run it..hmmm... Is this in Vista or 7? If so, try going to the cygwin directory and running the batch file directly as an administrator. It might not have the permissions as a normal user to access the account/etc files that it needs for the initial setup.
    That we enjoy great advantages from the inventions of others, we should be glad of an opportunity to serve others by any invention of ours, and this we should do freely and generously.
    --Benjamin Franklin
    TBCS 5TB Club :: coilgun :: bench PSU :: mightyMite :: Zeus :: E15 Magna EV

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •