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.

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

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.

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

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 '.

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

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

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

 ssh-host-config 

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

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 ".

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

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

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

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.

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

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

 ntsec 

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

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.

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

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

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

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.

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

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

 net start sshd 

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

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 

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

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.

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

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 '.

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

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.

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

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.

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

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
4.1 ★ | 21 Vote

Maybe you are interested