SSHDの設定ファイルの修正を行う。
パスワード認証を不可にし、RSA認証のみを許可するように
するために以下のように修正を行う。
| $ vim /etc/ssh/sshd_config (修正ポイントのみ抜粋) RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile>-.ssh/authorized_keys PermitRootLogin no ChallengeResponseAuthentication no RhostsRSAAuthentication no PasswordAuthentication no PermitEmptyPasswords no |
認証鍵の作成
SSHDにログインするユーザにて認証キーの作成を行う。
| $ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/ogi/.ssh/id_rsa): [Enter] Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/ogi/.ssh/id_rsa. Your public key has been saved in /home/ogi/.ssh/id_rsa.pub. The key fingerprint is: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx このメールアドレスは、スパムロボットから保護されています。アドレスを確認するにはJavaScriptを有効にして下さい |
認証鍵の設定
作成した認証鍵(公開鍵)をホームディレクトリ配下の「.ssh」に配置する。
| $ cd .ssh $ mv id_rsa.pub authorized_keys $ chmod 600 authorized_keys |
再起動
| $ service sshd restart |
以上で、完了である。
これからの設定を行うことで、パスワード認証ではログイン出来なくなる。
作成した、「id_rsa」を使ってログインを行うことになる。
以下のような感じ。
| $ ssh -i id_rsa [user name]@[server] |
| < 前 | 次 > |
|---|


