sshの公開鍵/秘密鍵の作成をしてログインをする


MacBook[~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/[username]/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/[username]/.ssh/id_rsa.
Your public key has been saved in /Users/[username]/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx [username]@MacBook.lan

で,id_rsa.pubという公開鍵を保存しておきたい計算機に持って行く.
その計算機で,
server[~]$ cat id_rsa.pub >> ~/.ssh/authorized_keys
とする.

いったんログアウトし,もう一度sshでその計算機に入ると,公開鍵認証を用いたログインができる.
さらに,Macだとキーチェインにパスワードを保存できるので,ログインがさらに楽になる.
Macの強みがさらに出てきたー.