Raspberry Pi 再セットアップ (02)
ssh関連。
ssh接続してみる(Macにて)
$ ssh pi@192.168.**.** @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 a host key has just been changed. The fingerprint for the RSA key sent by the remote host is f6:db:56:79:**:**:**:**:**:**:**:**:**:**:**:**. Please contact your system administrator. Add correct host key in /Users/****/.ssh/known_hosts to get rid of this message. Offending RSA key in /Users/****/.ssh/known_hosts:2 RSA host key for 192.168.**.** has changed and you have requested strict checking. Host key verification failed.
Mac上に、先代RasPiへの接続情報が残っているからWarningが出たっぽいので、該当行を削除してリトライ。
$ ssh pi@192.168.**.** # -> Mac pi@192.168.**.**'s password: pi@raspberrypi ~ $ # -> RasPi
OK。
authorized_keysファイル作成
$ cd $ mkdir .ssh $ chmod 700 .ssh $ cd .ssh $ touch authorized_keys $ chmod 600 authorized_keys $ vi authorized_keys
sshd設定&再起動
$ su - # cd /etc/ssh # cp -ip sshd_config sshd_config.bkup # vi sshd_config Port 22 # -> 好みのポート(nnn)に変更 PermitRootLogin yes # -> PermitRootLogin no に変更 PubkeyAuthentication no # -> PubkeyAuthentication yes に変更 PermitEmptyPasswords no # -> PermitEmptyPasswords yes に変更 #AuthorizedKeysFile %h/.ssh/authorized_keys # -> 頭の#を取る # /etc/init.d/ssh restart
ssh接続(再)
$ ssh pi@192.168.**.** -p nnn # -> Mac pi@raspberrypi ~ $ # -> RasPi
パスワード入力なしで接続できるようになった。
以降次回。