How to access SSH on Windows 7 using Cygwin

If you are comfortable using Linux / Unix and want to access SSH on a Windows 7 computer, you can use Cygwin. This Windows Linux emulator provides this functionality and gives you a familiar work environment with just a few simple steps.

If you are comfortable using Linux / Unix and want to access SSH on a Windows 7 computer, you can use Cygwin. This Windows Linux emulator provides this functionality and gives you a familiar work environment with just a few simple steps.

This article does not cover the installation and configuration of Cygwin, if you do not know how to do it, you can refer to the article Using Linux in Windows with Cygwin.

Install OpenSSH

Here we will use OpenSSH, so if not installed, find the setup.exe file and run it.

Picture 1 of How to access SSH on Windows 7 using Cygwin

You can keep all the default values ​​just like when you set up the original Cygwin. On the package selection screen, search for ' open ' and look in the ' Net ' menu.

Picture 2 of How to access SSH on Windows 7 using Cygwin

You will see a package called " openssh ", click on the " New " column and see " Skip " until the X appears in the " Bin? " Column. Look at the screenshot above to know what to choose if you're confused. Then click " Next" and complete the remaining setup process.

Configure OpenSSH in Cygwin

Unlike most Linux distributions, OpenSSH will not automatically configure to run and operate. We need to take a few simple steps. First, right click on Cygwin shortcut and click on ' Run as administrator '.

Picture 3 of How to access SSH on Windows 7 using Cygwin

This ensures you have the right rights to do everything. You will then see an empty Cygwin window appear.

Picture 4 of How to access SSH on Windows 7 using Cygwin
Enter the following command:

 ssh-host-config 

Picture 5 of How to access SSH on Windows 7 using Cygwin

You should see the script create some default files and then you will be prompted if you want to enable ' Privilege Separation '. By default, it will be enabled in standard OpenSSH settings on other systems, so continue and select " yes ".

Picture 6 of How to access SSH on Windows 7 using Cygwin

You will be prompted to create a new account with special permissions, select ' yes ' and the script will continue.

Picture 7 of How to access SSH on Windows 7 using Cygwin

Next, you will be asked if you want to run sshd as a service. This gives you SSH access even when Cygwin is not running. If yes, type yes to continue.

Picture 8 of How to access SSH on Windows 7 using Cygwin

Next, you will be asked to enter a value for the daemon. Enter the following command:

 ntsec 

Picture 9 of How to access SSH on Windows 7 using Cygwin

You will see the script provide some information on the system and ask you to create a special account with the default username ' cyg_server '. Leave the default settings unchanged and type ' no ' when you ask if you use a different account name, although you can change this if you like.

Picture 10 of How to access SSH on Windows 7 using Cygwin

Of course, you will also have to enter the password for this account.

Picture 11 of How to access SSH on Windows 7 using Cygwin

Cygwin will display your password in plain text for verification, so make sure you are in a safe place. You will see some additional information appear and if all is done correctly, you will receive a message telling you that the configuration is complete.

Picture 12 of How to access SSH on Windows 7 using Cygwin

You can restart or enter the following command to start the sshd service:

 net start sshd 

Picture 13 of How to access SSH on Windows 7 using Cygwin

Now, you can type " exit " to close Cygwin.

User configuration of SSH

Next, you need to create the appropriate SSH keys for your user account. Open normal Cygwin and enter the following command:

 ssh-user-config 

Picture 14 of How to access SSH on Windows 7 using Cygwin

You will be asked to create specific keys for your user account, so use what you need. In this example, type ' no ' for the first question and ' yes ' for the second question.

Picture 15 of How to access SSH on Windows 7 using Cygwin

SSH2 is more secure, so you can use it. After entering the password, you will be asked if you want to use that ID to access your device, type ' yes '.

Picture 16 of How to access SSH on Windows 7 using Cygwin

Next, you will be asked to create an SSH2 DSA ID file, if you want to use access without a password, you can decline at this step.

Picture 17 of How to access SSH on Windows 7 using Cygwin

So you've configured it. If you want to check the quick configuration, enter the following command in the Cygwin window:

 ssh –v localhost 

The -v option stands for "verbose" and gives you all the information of the process. You will be asked if you want to continue connecting, so enter ' yes ' and then enter your password at the prompt. Remember that when entering your username, it will be case sensitive.

Picture 18 of How to access SSH on Windows 7 using Cygwin

If everything works well, you will see the usual bash prompt.

Problems when setting up SSH access

If you are stuck at any configuration step, make sure that your Windows User Account is running with administrative access. You can get some strange errors if you run a host request with a normal user account, so be sure to run Cygwin with admin rights during that step. If you exit, you receive a prompt about the batch job running, press no to stop this.

Finally, if you check for SSH access from another computer and see an error, make sure your firewall doesn't block access to port 22 (or 23 if using SFTP).

This method works very well if you like the ability to access SSH / SFTP on files on a Windows 7 computer and you also want a familiar shell to do so. If you're wondering, Cygwin attaches a Windows drive to '/ cygdrive / driveletter '.

I wish you all success!

See more:

  1. How to activate and use SSH commands on Windows 10
  2. Back up the entire website with SSH Command Line
  3. How to install OpenSSH on Windows 10
Update 26 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile