sshアクセスに公開鍵認証を設定
[hiro@localhost ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hiro/.ssh/id_rsa):
Created directory '/home/hiro/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/hiro/.ssh/id_rsa.
Your public key has been saved in /home/hiro/.ssh/id_rsa.pub.
The key fingerprint is:
[hiro@localhost ~]$ ls -l /home/hiro/.ssh
-rw------- 1 hiro hiro 1743 4月 29 18:48 id_rsa
-rw-r--r-- 1 hiro hiro 408 4月 29 18:48 id_rsa.pub
秘密鍵→id_rsa
公開鍵→id_rsa.pub
[hiro@localhost ~]$ cd /home/hiro/.ssh
[hiro@localhost .ssh]$ mv id_rsa.pub authorized_keys
[hiro@localhost .ssh]$ chmod 600 authorized_keys
- "PuTTY"を使用しているので、"PuTTYgen"を使ってサーバで生成した秘密鍵をPuTTYで使用できるようにする。
パスワードログイン禁止
[root@localhost ~]# vi /etc/ssh/sshd_config
PermitEmptyPasswords no
PasswordAuthentication no
[root@localhost ~]# /etc/init.d/sshd restart
sshd を停止中: [ OK ]
sshd を起動中: [ OK ]
確認
login as: hiro
Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
最終更新:2010年04月30日 02:54