ServersManVPSをSSH公開鍵にした。。。

参考URL

http://d.hatena.ne.jp/deeeki/20100530/serversman_user_ssh

http://www.yamakawa.us/vpsserver/438.html

とか・・・。

今更かよ!的な。。

一番参考になったのはココかも。

http://gentoo.reichsarchiv.jp/item/17

要点だけまとめると。

# vim /etc/ssh/sshd_config

PermitRootLogin no
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
AllowUsers user user2 →追記 複数指定するときはスペースで区切る
PermitEmptyPasswords no
PasswordAuthentication no
ChallengeResponseAuthentication no

としーの。

ユーザーにsuしーの。

$ ssh-keygen -t rsa

そのままエンター

パスワード入力

$cat .ssh/id_rsa

で中身を表示させて、macbook air とか どこか適当にファイルをコピー。

公開鍵で接続が確認できるまでは

PasswordAuthentication no
ChallengeResponseAuthentication no

はyesにしとく。

セッションは切らない。

パーミッションには注意。

ユーザーのホームディレクトリは 755

クライアントでのknown_hostsは消しとく。

macbookairとitermでログインする場合。

ホームディレクトリ/.ssh/configに、

#################################
#
# ServerMans VPS
#
#################################
Host 接続名
HostName 接続先
Port 22
User ユーザ名
IdentityFile /秘密鍵までのパス/id_rsa

とかして、

itermのプロファイルとかに、

command のところに、ssh 接続名

とかすると楽。