Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cygwin openssh for windows

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Installation and configuration of Cygwin + OpenSSH FOR Windows

Cygwin is a world-famous software, it can transplant the free software under Linux to the Windows system for application. Understanding and mastering this software will give you many more useful choices and take you to a broader sky to soar, which will definitely promote your study and work. Below, I will use an example summed up by myself to take you into this world.

1. Installation method of cygwin

Click to install the following figure

Default next step

Enter http://mirrors.163.com/cygwin in User URL and click Add

Query ssh and select the tick marked in Net default (this will install ssh and ssl)

Install the vim plug-in

Second, install sshd service

Click the cygwin desktop shortcut

Output ssh-host-config-y after the session appears

This command installs the sshd service and generates two accounts, sshd and cyg_server

Cyg_server needs to set a password

Take a look at the bottom line, which shows that the installation of the service was successful!

Start the service net start sshd

There should be garbled code because of the coding problem. Does not affect the operation. You can also check whether the service starts normally in the list of services.

Add firewall rules

Add a station rule to the firewall to allow port 22 to enter.

Remarks: 1. Cygwin can realize ssh mutual trust.

2. The batch operation of the site can be realized by script.

The script is as follows (this script is only used as a way of thinking)

#! / bash/sh# time: 2016-07-12cd / cygdrive/c/Windows/System32/inetsrv echo "* *" echo "* *" echo "* IIS hypervisor script * "echo" * * "echo" * "echo" * 1) Recycle application pool * "echo" * 2) restart site service * "echo" * 3) restart the server service * "echo" * * "HostIP=192.168.1read-p" Please select the action you want to do: "arg case $arg in" 1) read-p "Please enter the web server you want to operate (for example, 192.168.1.87 only need to enter 87. Each ip is separated by a space): "WebIP if [[$WebIP = ~ [0-9] [0-9"] + $]] Then for ip in $WebIP do echo "web host IP: $HostIP.$ip" ssh root@$HostIP.$ip "cd / cygdrive/c/Windows/System32/inetsrv . / appcmd.exe list app "done read-p" Please enter the recycler application pool name: "zendao For ip in $WebIP do echo "web host IP: $HostIP.$ip" ssh root@$HostIP.$ip "cd / cygdrive/c/Windows/System32/inetsrv . / appcmd.exe recycle apppool\ "$zendao\"done else echo" the ip you entered is incorrect, please output it again. Format: each ip is separated by spaces, there can be no characters or other characters "fi;; 2) read-p" Please enter the web server you want to operate (such as 192.168.1.87 only need to enter 87. Each ip is separated by a space): "WebIP if [[$WebIP = ~ [0-9] [0-9"] + $]] Then for ip in $WebIP do echo "web host IP: $HostIP.$ip" ssh root@$HostIP.$ip "cd / cygdrive/c/Windows/System32/inetsrv . / appcmd.exe list site "done read-p" Please enter the name of the site to be restarted: "zendao" For ip in $WebIP do echo "web host IP: $HostIP.$ip" ssh root@$HostIP.$ip "cd / cygdrive/c/Windows/System32/inetsrv . / appcmd.exe stop site / site.name:\ "$zendao\"ssh root@$HostIP.$ip" cd / cygdrive/c/Windows/System32/inetsrv;. / appcmd.exe start site / site.name:\ "$zendao\"done else echo" the ip you entered is incorrect. Please export it again. Format: each ip is separated by spaces, there can be no characters or other characters "fi;; 3) echo" Zabbix client service: Zabbix Agent "read-p" Please enter the web server you want to operate (such as 192.168.1.87 only need to enter 87. Each ip is separated by a space): "WebIP read-p" Please enter the name of the service to be restarted: "zendao; if [[$WebIP = ~ ^ [0-9] [0-9"] + $]] Then for ip in $WebIP do echo "web host IP: $HostIP.$ip" ssh root@$HostIP.$ip "NET STOP\" $zendao\ " NET START\ "$zendao\" done fi;;) Echo-e "the option you entered is wrong, please re-enter the correct option!" Exit 0; esac

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report