Use the SSH command line to Access Windows 7 using cygwin

Source: Internet
Author: User
Document directory
  • Install OpenSSH
  • Configure OpenSSH in cygwin
  • SSH user configuration

Are you used to Linux/Unix and want to access a machine with Windows 7 installed through SSH? Cygwin provides this function, which allows you to implement this in a simple step in the environment you are familiar.

Here we assume that cygwin has been installed and configured. If not, refer to how to use Linux Command Line in Windows using cygwin.

Install OpenSSH

Here we will use openssh. if you do not have an installation, you can find the setup.exe file in cygwinand run it again.

You can use the default settings when installing cygwin. On the installation package Options page, search "open" to view the "Net" menu.

You will see an installation package named "OpenSSH. Click "new" and it will prompt "Skip" until you are in "bin ?" The following shows that X appears. If you are dizzy, you can return to the previous page and start again. Click "Next" to complete the subsequent steps, just like installing cygwin.

Configure OpenSSH in cygwin

Unlike most Linux applications, OpenSSH is not automatically configured before it runs normally. Some simple operations are required here. First, right-click the cygwin shortcut and click "Run as administrator ":

This ensures that we have reasonable permissions to perform any operation. You will see an empty cygwin window.

Enter the following command:

Ssh-host-config

You will see these scripts generate some default files, and whether the "permission separation" function is enabled. OpenSSH is enabled by default in other systems, so you can directly enter "yes ".

It will prompt you to create a special permission account, and select "yes" to continue running.

Next, we will ask if you want to run sshd as a service. In this way, you can access SSH no matter whether cygwin is currently running or not. This is what we need. Select "yes" to continue.

In the next step, you are required to enter a value for the daemon. You can enter:

Ntsec

You will see the script provides you with some information in the system, and then ask you to create a priority account named "cyg_server" by default. When you are prompted whether you want to use another name, you can enter "no", because the default name is also very useful, you can also modify it if you really do not like it.

Of course, you also need to set a password for this account.

Cygwin will display your password in text format. Make sure you enter the password in the installation environment. You will also see other information. If everything is normal, you will receive a prompt for success.

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

Net start sshd

Now you can enter "exit" to disable cygwin.

SSH user configuration

Next, we will create appropriate SSH key content for your user account.

Ssh-user-config

It will ask you if you want to create specific key content for your account and make a choice based on your needs. I will select "no" for the first prompt and "yes" for the second prompt ".

SSH2 is more secure, so I recommend you use it here. After you enter the password, it will ask if you want to use the ID to access your computer and enter "yes ".

Next, it will ask you to create the SSH2 dsa id file, if you do not want to use a password for access. In this step, I entered "no ".

That's easy! You have completed all the configurations. If you want to quickly test your configuration, enter the following command line in the cygwin window:

Ssh-V localhost

Option-V indicates that all details of the process run are displayed. It will ask you if you want to continue the connection, enter "yes", and then enter the password as prompted. Remember, when you enter a user name, it is case sensitive.

If everything is normal, you will see a normal bash command line prompt.

Tips

If you feel helpless during the configuration process, be sure to use the administrator privilege to run the program. If you see some weird prompts when you use a common user to configure the host, make sure that you use the Administrator permission to run cygwin. When you exit, you will be prompted whether to continue running the job. You can enter "no" to end them.

Finally, if an error message is prompted when you Test Access to SSH from another computer, make sure that the firewall does not block access port 22 (if the corresponding SFTP port is 23 ).

If you want to use shell and access your Windows 7 system through SSH/SFTP, this is indeed a good method. If you want to, you can also mount Windows hard drive partitions on cygwin to "/cygdrive/driveletter ".

 

From: http://article.yeeyan.org/view/200054/169568

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.