您的位置:首页 > 其它

ssh配置免密登录

2017-09-26 00:00 197 查看
[sunday@CentOS-00 ~]$ cd .ssh/
[sunday@CentOS-00 .ssh]$ ll
总用量 4
-rw-r--r--. 1 sunday sunday 391 9月  26 11:25 known_hosts
[sunday@CentOS-00 .ssh]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/sunday/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/sunday/.ssh/id_rsa.
Your public key has been saved in /home/sunday/.ssh/id_rsa.pub.
The key fingerprint is:
c3:92:57:dd:5d:5f:52:55:cc:e4:76:a1:ed:3b:fc:57 sunday@CentOS-00
The key's randomart image is:
+--[ RSA 2048]----+
|              .*X|
|           . .o+B|
|          . ....*|
|       o .    ...|
|      o S      . |
|       o .    . E|
|               +.|
|                +|
|                o|
+-----------------+
[sunday@CentOS-00 .ssh]$ ll
总用量 12
-rw-------. 1 sunday sunday 1675 9月  26 11:31 id_rsa
-rw-r--r--. 1 sunday sunday  398 9月  26 11:31 id_rsa.pub
-rw-r--r--. 1 sunday sunday  391 9月  26 11:25 known_hosts
[sunday@CentOS-00 .ssh]$ touch authorized_keys
[sunday@CentOS-00 .ssh]$ ll
总用量 12
-rw-rw-r--. 1 sunday sunday    0 9月  26 11:32 authorized_keys
-rw-------. 1 sunday sunday 1675 9月  26 11:31 id_rsa
-rw-r--r--. 1 sunday sunday  398 9月  26 11:31 id_rsa.pub
-rw-r--r--. 1 sunday sunday  391 9月  26 11:25 known_hosts
[sunday@CentOS-00 .ssh]$ cat id_rsa.pub > authorized_keys
[sunday@CentOS-00 .ssh]$ chmod 600 authorized_keys
[sunday@CentOS-00 .ssh]$ ssh localhost
Last login: Tue Sep 26 11:25:20 2017 from localhost
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ssh 免密