DreamHostでターミナル(putty)を使ってSSH接続する

DreamHostでターミナル(putty)を使ってSSH接続したときの覚書。

1.puttyをダウンロード&インストールする

参考サイト
——————————————-
http://www.adminweb.jp/web-service/ssh/index2.html
——————————————-

2.SSH接続に必要な秘密鍵と公開鍵の生成

PuTTYのインストールと同時にインストールされたPuTTYgenを起動させる。
デフォルトでSSH2-RSAになっているはずなので、そのままgenerateをクリックして生成開始。パラメータが右に伸び終わるまで画面内でマウスを適当に動かし続ける。するとランダムなデータを生成される。

Save public key(公開鍵)ボタンとSave private key(秘密鍵)ボタンを押して、それぞれ保存する(保存先はとりあえずデスクトップでいい)。

参考サイト
——————————————-
http://sourceforge.jp/projects/winscp/wiki/ui_puttygen
——————————————-

3.public key(公開鍵)をサーバーに置く

FFFTPでサーバーにログインしてroot「一番上、/だけの所」に「.ssh」というフォルダを作り、そこに public key を置く。public key のファイル名は「authorized_keys」(拡張子なし)に変更しておく。

4.DreamHostでSSHが使えるように設定変更

ブラウザからDreamHostにログインする。「Web Panel」の「toolbox」にある「Manage User」をクリック。そこの「Edit」から「User Type」を「Shell user」に変更する。

5.PuTTYでログインする

PuTTYを起動。Hostnameに自分が利用しているDreamHostのサーバーアドレスを入力。左の Category から「Connection」→「SSH」→「Auth」を選択。「Private key for authentication(認証用の秘密鍵)」のところから先ほど保存した private key(拡張子が ppk のもの)を選択して「Open」を押す。

これで接続されるはず。初めて接続するとき以下のメッセージが出るが「このサーバーで正しいか?」という確認なので「はい」を選択する。

PuTTY の alert
——————————————-
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 rsa2 key fingerprint is:
ssh-rsa 2048 6f:60:44:2c:61:7e:49:70:42:c8:99:0a:09:e3:6a:5b
If you trust this host, hit Yes 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, hit No.
If you do not trust this host, hit Cancel to abandon the
connection.
——————————————-

コマンドプロンプトのような黒い画面が出て login as と表示されるので DreamHostで設定したFTP Username を入れてその後 Password を入れるとログイン完了。

ログインまでにもたもたしていると「Server unexpectedly closed network connection」とメッセージが出て切断されるので、その場合は再接続する。

「Server unexpectedly closed network connection」が出続ける場合は使っているIPアドレスが DreamHost 側でブロックされているので、DreamHost に解除依頼をする必要があるみたい。↓

——————————————-
If you get this error when attempting to SSH, this can mean your IP has been blocked. Contact support and we will check to see if your IP is blocked. If so, we will be able to whitelist it. If you don’t know your IP, visit
——————————————-

大まかな流れの参考になったサイト
——————————————-
http://www.azumatech.net/blog/2010/02/12/dreamhost%E3%81%ABssh%E6%8E%A5%E7%B6%9A/
——————————————-

タイトルとURLをコピーしました