Create an SSH server on Windows

Source: Internet
Author: User
Tags ssh server dns spoofing

How to create an SSH server on Windows

1. Ssh introduction and application scenarios in this example

① Introduction to SSH

SSH is a toolkit used to replace telnet, FTP, and r commands. It mainly aims to solve the problem of plaintext transmission of passwords on the Internet. To ensure system security and users' own rights and interests, it is necessary to promote ssh. SSH is short for the English Secure Shell. By using SSH, You can encrypt all transmitted data, so that the "man-in-the-middle" attack method is impossible, and it can also prevent DNS Spoofing and IP spoofing.

② Application scenarios in this example

 

The user remotely executes commands on the server (Windows) through SSH on the client (Linux), such as c: \ test. bat

Note: Linux comes with an SSH server and is started by default. For detailed settings, see Google.

 

2. Install the SSH server (Windows)

There are many SSH server software. Here we use free FreeSSHD.

1 first download the software from the official site and install (http://www.freesshd.com /)

② After the installation is complete, enter the configuration page (server status) to confirm that the SSH server is running

 

③ Go to the users interface and set an access user account (such as wust)

 

Here we create a user named wust. There are three authentication methods available. For the convenience of running commands through SSH in the future (without entering a password), we should select the public key authentication method. If you select the password method, you need to enter a password for each access. This method is cumbersome and less secure. Then, open the shell permission.

 

④ Go to the authentication page and confirm that the public key authentication method is active (select allowed or required)

 

At this time, the basic settings of the SSH server are OK. You can perform more detailed settings (such as access restrictions.

Note: if there is a protective wall on the server side, you should develop TCP port 22 to use the most SSH connection.

 

3. SSH client settings (Linux)

Because our client uses Linux, there is no need to install the client software.

 

We need to create a common and private key pair on Linux, put the private key on the client (Linux), and put the common key on the server (Windows. On Linux, use the ssh-keygen command.

[Root @ localhost ~] # Ssh-keygen-T RSA
Generating public/private RSA key pair.
Enter file in which to save the key (/root/. Ssh/id_rsa): [Press enter]
Enter passphrase (empty for no passphrase): [Press enter]
Enter same passphrase again: [Press enter]
Your identification has been saved in/root/. Ssh/id_rsa.
Your public key has been saved in/root/. Ssh/id_rsa.pub.
The key fingerprint is:
4d: DD: 48: AF: 76: C2: BA: A8: BC: 20: F3: 28: 1D: 6a: 28: 53

Here,/root/. Ssh/id_rsa is the private key and/root/. Ssh/id_rsa.pub is the common key.

In this case, you need to put the common key on the server (Windows) for saving, so that the server can perform security checks.

We can find the Public Key folder on the authentication interface ).

 

As shown in, create a text file named "Logon username" in the c: \ Program Files \ FreeSSHD directory. Here, we use the wust file as an example. Copy the content in the/root/. Ssh/id_rsa.pub file to the C: \ Program Files \ FreeSSHD \ wust file.

So far, the client-side and server-side key settings have been completed. You can run the following command remotely.

SSH wust@122.205.xx.xxx "C: \ test. Bat"

This command will execute the test. BAT file in drive C of the server and return the result. The password is not required for the entire operation.

 

4. SSH client settings (Windows)

Because Windows does not include SSH clients and servers, we need to find a free client software putty.

Putty home: http://www.chiark.greenend.org.uk /~ Sgtatham/Putty/

Comparison of clients: http://en.wikipedia.org/wiki/Comparison_of_SSH_clients

On the main puttypage, we downloaded putty.zip(excluding all the files provided by puttytel, then we found a file named plink.exe, which is our SSH client command line software.

First, we need to generate a common and private pair, which is generated using puttygen.exe included in putty.zip.

After you start puttygen.exe, you can see the interface. Click [generate] to generate the desired key pair.

Note: RandomAlgorithmGenerated. You need to move the mouse progress bar continuously in the dialog box to increase the value; otherwise, the value remains unchanged.

 

After the key is generated, you can save the private key. For the sake of simplicity, the private key is not encrypted, and you are prompted to ignore the passphrase. Assume that the private key is saved as pri_key.ppk.

We store the public key on the FreeSSHD side (the SSH server side) for saving. For more information about how to save the public key, see [SSH client settings (Linux )].

On the Windows client, run the following command to perform SSH connection. You do not need to enter a password to perform automatic authentication using the key.

Plink-I pri_key.ppk wust@122.205.xxx.xx

 

Note: "the server's host key is not cached in the Registry... "Prompt, we can select OK, and it will not appear again in the future.

 

.

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.