window 上安裝 Cygwin 和 SSH 服務


從unix 機器上 SSH  到 window機器上,要在window 上安裝   Cygwin 和 SSH 服務

1. 安裝 Cygwin: 

1.1 下載安裝程序

http://www.cygwin.com/

 1.2  雙擊安裝程序 以及 選擇參數

 


 


 




 


1.3 選擇SSH 包  (默認是沒有SSH 的,要手動選擇. 不知道選哪個就都選中)。 

依次點下一步直到完成。

 


2. 配置SSH

2.1  配置環境變量 

右擊我的電腦 ,  屬性> 高級> 環境變量
在系統變量下 點擊新建, 添加變量名 CYGWIN , 變量值 ntsec 
在系統變量下, 編輯Path, 添加 ;c:\cygwin\bin 

 2.2 配置 SSHD 服務

運行 C:\cygwin64\Cygwin.bat或終端

在窗口中輸入  

ssh-host-config
*** Query: Should privilege separation be used? <yes/no>: yes
*** Query: New local account 'sshd'? <yes/no>: yes *** Query: Do you want to install sshd as a service? *** Query: <Say "no" if it is already installed as a service> <yes/no>: yes *** Query: Enter the value of CYGWIN for the deamon: [] binmode ntsec *** Query: Do you want to use a different name? (yes/no) yes/no 

如果用相同的名字 cyg_server, 輸入no. 

*** Query: Create new privileged user account 'cyg_server'? (yes/no) yes
*** Query: Please enter the password:
*** Query: Renter:

如果選擇不同的名字, 輸入 yes. 

*** Query: Enter the new user name: cyg_server1
*** Query: Reenter: cyg_server1
*** Query: Create new privileged user account 'cyg_server1'? (yes/no) yes
*** Query: Please enter the password:
*** Query: Reenter:

配置成功,你會看到下面消息:

Host configuration finished. Have fun!

這樣會在  控制面板  —>服務  里面 看到

 

2.3 配置賬戶

  1. 右擊  我的電腦, 選擇 管理

  2. 在彈出框里(在服務與應用下), 選擇 CYGWIN sshd.

  3. 右擊CYGWIN sshd 選擇屬性.

  4. 在彈出框上, 選擇 登陸.

  5. 指定用戶名和密碼. 點擊應用.

 

2.4  啟動與停止SSH  服務

a  啟動
 
在Cygwin 終端    輸入bash    再輸入 net start sshd 
 
或者控制面板->服務  直接手動 CYGWIN sshd  右鍵選擇啟動
 
或者雙擊 C:\cygwin64\Cygwin.bat  cygrunsrv -S sshd
 
b  停止
 
在Cygwin 終端   輸入  net stop sshd

3.  測試與連接

 
用putty登陸  里的UNIX系統 (賬號 是2.3 設置的),  輸入
 
SSH  機器名或者IP

4.   更多問題 參見

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM