Cygwin:Windows で「ssh server」を構築する

Cygwin:Windows で「ssh server」を構築する方法です。

blickpixel / Pixabay

0.Cygwinのバージョン

$ uname -r
1.7.9(0.237/5/3)

1.インストール方法

Cygwin Setup(setup.exe)を起動し以下パッケージをインストールする
→  openssh: The OpenSSH server and client programs

2.サーバー初期設定

$ ssh-host-config
(Enter..)
Should privilege separation be used? (yes/no) {yes}
new local account 'sshd'? (yes/no) {yes}
Do you want to install sshd as service?
(Say "no" if it is already installed as service) (yes/no) {yes}
Enter the value of CYGWIN for the daemon: [] {enter}
Do you want to use a different name? (yes/no) {no}
Do you want to use a different name? (yes/no) no
Create new privileged user account 'cyg_server'? (yes/no) no

* Windowsサービス名「CYGWIN sshd」として登録される
* sshdの設定ファイル(/etc/ssh/sshd_config)を適切に設定する
* 外部からのアクセスにはWindows Firewallの設定が必要

付録:cygrunsrvの操作

サービスの開始
$ cygrunsrv -S sshd
サービスの停止
$ cygrunsrv -E sshd
サービスの状態
$ cygrunsrv -Q sshd
Service             : sshd
Display name        : CYGWIN sshd
Current State       : Running
Controls Accepted   : Stop
Command             : /usr/sbin/sshd -D

以上


About yoshimasa

埼玉県さいたま市在住、2男3女のパパです。Linux系の技術情報を中心にまとめています。1978年2月生まれ。