Linux配置 SSH无密码登录

本文详细介绍了如何使用ssh-keygen命令生成SSH密钥对,并进行必要的文件权限设置,以便实现无密码登录。通过本教程,读者可以学会创建私钥和公钥,将公钥添加到授权密钥文件中,并确保所有文件的正确权限设置。
[root@inode ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
26:9f:d3:b6:82:9c:6e:76:57:dc:d7:1d:1d:86:91:c2 root@inode
The key's randomart image is:
+--[ RSA 2048]----+
|          .  .+  |
|           E o o |
|            . . o|
|               ..|
|      . S  . .  +|
|       + o  o . +|
|     . o+ o.   . |
|      * oo..     |
|     +.. o.      |
+-----------------+
[root@inode ~]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
[root@inode ~]# chmod 600 /root/.ssh/authorized_keys
[root@inode ~]# chmod 700 /root/.ssh/

[root@inode ~]# ll .ssh
总用量 12
-rw-------. 1 root root  392 1月   6 00:51 authorized_keys
-rw-------. 1 root root 1675 1月   6 00:51 id_rsa
-rw-r--r--. 1 root root  392 1月   6 00:51 id_rsa.pub
[root@inode ~]#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值