﻿# 在 Cygwin 下安裝 SSHD 的方式

**安裝步驟**

1.  安裝 cygwin 時，套件中必須勾選:
    
    -   Admin --> cygrunsrv
        
    -   Net --> openssh
        
2.  進入 Cygwin 並執行 ssh-host-config 指令:
    
    -   privilege separation be used? (yes/no) **no**
        
    -   Do you want to install sshd as service? **yes**
        
    -   認證方式輸入預設 **ntsec**
        
3.  啟動服務
    
    -   cygrunsrv.exe  --start sshd
        
4.   讓 sshd 隨著 Windows 一起啟動
    
    -   cygrunsrv.exe  --install sshd
        

**常用指令**

-   列出目前所安裝的服務
    
    -   cygrunsrv.exe  -L
        
-   啟動服務
    
    -   cygrunsrv.exe  --start <service name>
        
-   停止服務
    
    -   cygrunsrv.exe  --stop <service name>
        
-   安裝服務
    
    -   cygrunsrv.exe  --install <service name>
        
-   移除服務
    
    -   cygrunsrv.exe  --remove <service name>
