- 鍵作成
$ ssh-keygen -t rsa -b 4096 -f ssh-userkey-personel.bastion-XXXXXXX-20111230 -C "ssh-userkey-personel.bastion-XXXXXXX-20111230"
- authorized_keysに公開鍵追加
$ cat ~/.ssh/authorized_keys
[...]
ssh-rsa AAAAB3NzJNJmw1jL670nMw2[ ... ]W/J/6pbhiG8l3x4GG8gDiDYVfmw== ssh-userkey-personel.bastion-XXXXXXX-20111230
$
- ssh_config 設定追加
$ pwd
/Users/aka/.ssh/
$ cat config
Host github
HostName github.com
User git
PasswordAuthentication no
ChallengeResponseAuthentication no
PubkeyAuthentication yes
RSAAuthentication yes
# Identity for the default account
IdentityFile ~/.ssh/ssh-userkey-personel.bastion-XXX-20111230
# Identity for akacs account
IdentityFile ~/.ssh/ssh-userkey-personel.bastion-XXX-20120128
# I have two accounts on the github. The default account and akacs account.
# I created the second 'personel.bastion' key pairs because the github doesn't allow to use same key for different accounts.
Host *
PasswordAuthentication no
ChallengeResponseAuthentication no
PubkeyAuthentication yes
RSAAuthentication yes
IdentityFile ~/.ssh/ssh-userkey-personel.bastion-XXX-20111230
$
- sshd_config 設定例
$ cat /etc/sshd_config
SyslogFacility AUTHPRIV
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
# PasswordAuthentication yes
PermitEmptyPasswords no
ChallengeResponseAuthentication no
AcceptEnv LANG LC_*
Subsystem sftp /usr/libexec/sftp-server
$