Are you comfortable with Linux/Unix and want SSH access to your Windows 7 machine? Cygwin provides this functionality and gives you a familiar environment to work with in a few simple steps.
We’re assuming you’ve got Cygwin installed and configured. If not, check out our article, How To Use Linux Commands in Windows with Cygwin to get started.
OpenSSH is what we’ll be using, so if you don’t have it installed, find Cygwin’s setup.exe file and run it.
You can keep all of the same defaults as when you originally set up Cygwin. On the package selection screen, search for “open” and look under the “Net” menu.
You’ll see a package called “openssh”. Click under the “New” column, where it says “Skip” until you see an X appear in the “Bin?” column. Look at the previous screenshot for where to click if you’re confused. Hit “Next” and finish up the rest of the setup process, just like you did last time.
Configuring OpenSSH in Cygwin
Unlike in most Linux distros, OpenSSH won’t automatically configure itself to run and just work. We need to perform a few easy steps. First, right-click your Cygwin shortcut, and click on “Run as administrator”:
This will make sure we have the proper privileges for everything. You’ll see an empty Cygwin window come up.
Enter the following command:
You’ll see the script generate some default files, and then you’ll be prompted for whether or not you want to enable “Privilege Separation.” It’s on by default in standard installations of OpenSSH on other systems, so go ahead and say “yes” to the prompt.
You’ll be prompted to create a new account with special privileges. Select “yes” and the script will continue.
Next, you’ll be asked if you want sshd to run as a service. This will allow you to get SSH access regardless of whether or not Cygwin is currently running, which is what we want. Go ahead and hit “yes” to continue.
Next, you’ll be asked to enter a value for the daemon. Enter the following:
You’ll see the script give you some information on your system and then it will ask you to create a privileged account with the default username “cyg_server”. The default works well, so type “no” when it asks you if you want to use a different account name, although you can change this if you really like.
Of course, you’ll have to enter a password for this account as well.
Cygwin will show you your password in plain text for verification, so be sure you’re in a secure place. You’ll see some extra info come up and if all’s well, you’ll get a message that says it successfully completed.
You can either restart, or enter the following command to start the sshd service:
net start sshd
Now, you can type “exit” to close this Cygwin instance.
User Configuration of SSH
Next, we’ll create the appropriate SSH keys for your user account. Open up Cygwin normally, and enter the following command:
You’ll be asked to create specific keys for your user account, so use what you need. I went ahead and said “no” to the first question, and “yes” to the second.
SSH2 is more secure, so that’s what I recommend to you. After entering a password, you’ll be asked if you want to use that ID to access your machine. Type “yes”.
Next, you’ll be asked to create an SSH2 DSA ID file, if you want to use password-less access. I declined at this step.
That’s it! You’re all configured. If you want to test your configuration really quickly, enter the following command in your Cygwin window:
ssh –v localhost
The –v option stands for “verbose” and gives you all of the details of the process. You’ll be asked if you want to continue connecting, so enter “yes” and then enter your password at the prompt. Remember that when you enter your username, it is case-sensitive!
If everything worked out well, you’ll see a normal bash prompt.
If you find yourself stuck at any of the configuration steps, make sure that the Windows User Account you’re running has Administrative access. You may get weird errors if you try to run the host configuration as a normal user, so make sure you run Cygwin with admin privileges during that step. If, when you exit, you get a prompt about leaving your batch jobs running, you can hit “no” to terminate them.
Lastly, if you test SSH access from another machine and get an error, make sure that your firewall isn’t blocking access to port 22 (or 23 if you’re using SFTP).
This works extremely well if you like the ability to get SSH/SFTP access to your files on a Windows 7 machine and you also want a familiar shell to do that with. Cygwin mounts Windows drives to “/cygdrive/driveletter” in case you were wondering. ;-)
- › How To Remotely Copy Files Over SSH Without Entering Your Password
- › Roundup: The Best Windows Home Server Apps
- › 5 Ways to Run Linux Software on Windows
- › How To Improve Your Cygwin Console With Mintty
- › Learn the Ins and Out of OpenSSH on Your Linux PC
- › Logitech MX Mechanical Keyboard Review: Easy on the Eyes, Not the Fingertips
- › What Do “FR” and “FRFR” Mean?
- › AMD’s Ryzen 7000 Series Are the First 5nm Desktop CPUs Ever