「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。 -[[戻る>Linux]] * 目次 [#df0c4c8d] #contents *概要 [#ne4b9a8f] -WindowsのSSH、telnetクライアント -SSH接続は、下記参考の通り行う。 **ダウンロード [#n6c244a7] -Download PuTTY:~ https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html **インストール [#d178ca81] デフォルト設定でインストール *公開鍵 [#m4b3fe7b] **キー生成 [#u3cae56b] ***puttygen.exeを起動 [#p7a1872c] ***Generateボタンを押下 [#c1baf23a] (Please generate some randomness by moving the mouse over the blank area.) → 押下後、マウスカーソルを動かしてキー生成。 ***生成されたキーを保存 [#qd1814f8] -公開鍵を上部テキストから取得 -秘密鍵をファイルに保存(passphraseは空のまま) **キー配置 [#k04f8bdc] 公開鍵をサーバの「~/.ssh/authorized_keys」ファイルに追加する。 ***.sshディレクトリの作成 [#c4e8d6d2] mkdir ~/.ssh ***authorized_keysファイルの作成 [#lbc2df0e] vi ~/.ssh/authorized_keys ***authorized_keysファイルに公開鍵を[[ペースト>#a54c7b15]] [#zc1dc1f8] **接続テスト [#r4e5fbe1] ***SSHサーバと接続をテスト [#odd95828] plink.exeを使用して接続テストする。 c:\...\plink.exe -i c:\...\ssh-key.ppk xxxx@yyyy -batch -T echo "hello world" REM 'hello world' should print ***初回は以下の表示がある。 [#s154a7cf] The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server's ssh-ed25519 key fingerprint is: ssh-ed25519 255 ae:c6:f5:99:ab:41:39:ad:7d:fa:8b:9a:8d:bd:c0:24 If you trust this host, enter "y" to add the key to PuTTY's cache and carry on connecting. If you want to carry on connecting just once, without adding the key to the cache, enter "n". If you do not trust this host, press Return to abandon the connection. Store key in cache? (y/n) y *ハマりどころ [#rad75d9c] ハマりどころのメモ。 *ハマり所 [#rad75d9c] ハマり所のメモ。 **Terminal+[[vi>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?vi]]にコピペ [#a54c7b15] 公開鍵を、 -(puttygen.exeから、)コピーする。 -[[viの挿入モードで、ターミナルの機能を使用してペーストを行う。>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?vi#y49ed629]] **パーミッション [#rfc9bcce] ファイル属性のパーミッションについては、[[コチラ>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?Linux%E3%81%AE%E5%90%84%E7%A8%AE%20%E5%9F%BA%E7%A4%8E#d8accab2]]。 ***.sshディレクトリ [#xfb2f202] 755でないと正しく動作しない。 $ cd ~/ $ ls -al total xx ... drwxrwxrwx 1 seigi seigi 512 Aug 20 13:29 .ssh $ chmod 755 .ssh $ ls -al total xx ... drwxr-xr-x 1 seigi seigi 512 Aug 20 13:29 .ssh ***authorized_keysファイル [#g1b326cb] 644または600でないと正しく動作しない。 $ cd ~/.ssh $ ls -l total 0 -rw-rw-rw- 1 seigi seigi 398 Aug 20 13:12 authorized_keys $ chmod 600 authorized_keys $ ls -l total 0 -rw------- 1 seigi seigi 398 Aug 20 13:12 authorized_keys *参考 [#xfc4f53a] -PuTTY: a free SSH and Telnet client~ https://www.chiark.greenend.org.uk/~sgtatham/putty/ -PuTTYgenの利用~ https://www.tempest.jp/security/keygen.html -PuTTY を使うには~ https://www.ranvis.com/doc/putty/man/Chapter2.html ---- Tags: [[:Windows]], [[:Linux]]