sshキー生成

提供: Wikiducca
移動: 案内検索

忘れるのでメモ。

[[email protected] ~]# su - hogeo
[[email protected] ~]$ pwd
/home/hogeo
[[email protected] ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hogeo/.ssh/id_rsa):
Created directory '/home/hogeo/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/hogeo/.ssh/id_rsa.
Your public key has been saved in /home/hogeo/.ssh/id_rsa.pub.
The key fingerprint is:
ab:c1:d2:3e:45:67:8f:9g:h0:i1:12:jk:34:l5:67:89 [email protected]
[[email protected] ~]$

[[email protected] ~]$ cd .ssh/
[[email protected] .ssh]$ ls -l
合計 8
-rw-------  1 hogeo staff 951  4月  4 14:23 id_rsa
-rw-r--r--  1 hogeo staff 231  4月  4 14:23 id_rsa.pub

[[email protected] .ssh]$ mv id_rsa.pub authorized_keys

[[email protected] .ssh]$ chmod 600 authorized_keys
[[email protected] .ssh]$
[[email protected] .ssh]$ ls -la
合計 16
drwx------  2 hogeo staff 4096  4月  4 14:24 .
drwx------  4 hogeo staff 4096  4月  4 14:23 ..
-rw-------  1 hogeo staff  231  4月  4 14:23 authorized_keys
-rw-------  1 hogeo staff  951  4月  4 14:23 id_rsa
[[email protected] .ssh]$

id_rsa をローカルに落とす。


[メモ] su せず、 root で生成する場合

nologin ユーザの sftp 用に必要なとき 等。

[[email protected] ~]# ssh-keygen -C [email protected]


以上。