linux rsa登录改密码登录_配置Linux免密码登陆

[配置Linux 免密码登陆](#配置Linux 免密码登陆)[1 生成秘钥对,一路回车就好](#1 生成秘钥对,一路回车就好)

[2 修改公钥名称为authorized_keys](#2 修改公钥名称为authorized_keys)

[3 修改权限为600](#3 修改权限为600)

[4 修改sshd配置文件](#4 修改sshd配置文件)

[5 重启sshd服务](#5 重启sshd服务)

配置Linux 免密码登陆

友情提示:如果需要实现xshell 等终端工具实现免密码登陆的,在生成密钥对的时候,务必先把id_rsa就拷贝出来,不然到时候你配置好了的时候,通过xftp等工具拷贝文件出来,发现本地没有密钥文件,到时候就是死循环了。切记切记!!

1 生成秘钥对,一路回车就好

[root@localhost ~]# ssh-keygen

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:

92:98:a4:6d:a3:bf:04:67:f5:5f:d9:e2:9f:e1:b8:c1 root@localhost.localdomain

The key's randomart image is:

+--[ RSA 2048]----+

| |

| |

| . . |

| + + o o |

| o O o S + . |

| * . . . + . |

| . . . E . |

| o = o |

| o. o.+ |

+-----------------+

[root@localhost ~]#

2 修改公钥名称为authorized_keys

[root@localhost .ssh]# cd /root/.ssh/

[root@localhost .ssh]# cat id_rsa.pub >authorized_keys

3 修改权限为600

[root@localhost .ssh]# chmod 600 authorized_keys

4 修改sshd配置文件

[root@localhost .ssh]# vi /etc/ssh/sshd_config

RSAAuthentication yes

PubkeyAuthentication yes

AuthorizedKeysFile .ssh/authorized_keys

PasswordAuthentication no

5 重启sshd服务

[root@localhost .ssh]# service sshd restart

Stopping sshd: [ OK ]

Starting sshd: [ OK ]

[root@localhost .ssh]#

最后拷贝is_rsa 到任意地方保存即可实行无密码登陆

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值