end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

パスワードなしssh loginに使用するauthorized_keysは、権限を600に

http://www.atmarkit.co.jp/flinux/rensai/linuxtips/447nonpassh.html

@itでも紹介されていますが、パスワードなしのssh loginを行うには、まず、次のような手順で秘密鍵(id_rsa)と公開鍵(id_rsa.pub)が作成してください。

[endo@colinux ~]$ ssh-keygen -t rsa  ←RSA暗号方式の鍵を作成
Generating public/private rsa key pair.
Enter file in which to save the key (/home/endo/.ssh/id_rsa): ←[Enter]のみ
/home/endo/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):  ←[Enter]のみ
Enter same passphrase again:  ←[Enter]のみ
Your identification has been saved in /home/endo/.ssh/id_rsa.
Your public key has been saved in /home/endo/.ssh/id_rsa.pub.
The key fingerprint is:
b1:e8:93:50:06:92:00:df:cb:54:85:34:92:4c:13:2d endo@colinux
[endo@colinux ~]$ 


次に公開鍵(id_rsa.pub)を ~/.ssh/authorized_keysに追加しますが、authorized_keysのパーミッションを600に変更しないと、パスワードなしssh loginが成功しないので忘れずに。と、自分に言い聞かせる

[endo@colinux ~]$ cat id_rsa.pub >> ~/.ssh/authorized_keys
[endo@colinux ~]$ chmod 600 ~/.ssh/authorized_keys