ホスト側で ssh-keygen
でパスフレーズを入れて id_rsa と id_rsa.pub を作る。
cat id_rsa.pub >> authorized_keys
sudo vim /etc/ssh/sshd_config
・ポート番号22以外に変える Port 2233 <code>・AuthorizedKeyFileを指定する(#を外す AuthorizedKeysFile %h/.ssh/authorized_keys ・ChallengeResponseAuthenticationをNoにする ChallengeResponseAuthentication no ・PasswordAuthenticationをNoにする PasswordAuthentication no</code>
編集終了
パーミッションの変更
chmod 700 ~/.ssh chmod 600 ~/.ssh/*
id_rsaを何らかの方法でクライアント側に渡す。
ssh -p 2233 hoge@192.168.1.x
でつなぐと、初めて繋ぐときだけ登録するよと言われるのでYes パスフレーズを聞かれるので、入力