ContOS6 インストールメモ – SSH

SSHの設定でつまずいたのでメモ。

そもそも同じ固定IPでマシンを変えていたために発生したエラー。

基本設定は後述。
発生したエラーは下記の通り。

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now
 (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
piyo:piyo:piyo:piyo:piyo:piyo
Please contact your system administrator.
Add correct host key in /ユーザフォルダ/ユーザ名/.ssh/known_hosts to 
get rid of this message.
Offending key in /ユーザフォルダ/ユーザ名/.ssh/known_hosts:3
RSA host key for 固定IPアドレス has changed and you have 
requested strict checking.
Host key verification failed.

というエラーが発生。
よく読めば分かるのだがknown_hostsファイルがかぶっているためパスワードが登録できなくなっている。

(今回は秘密鍵認証を使用していない)

そのため「ユーザフォルダ/ユーザ名/.ssh/known_hosts」ファイル内の該当行を削除することで接続が可能になった。

セキュリティは今回は「/etc/hosts.allow」「/etc/hosts.deny」のTCP Wrapperにて対処。
特定IPアドレスからのみ、アクセス可能とした。 KVM用マシンのため。

カテゴリー: 日常   パーマリンク

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です