美文网首页Linux 相关文章
配置Linux免密码登陆

配置Linux免密码登陆

作者: 不会写诗的王维 | 来源:发表于2016-05-08 23:54 被阅读0次

[配置Linux 免密码登陆](#配置Linux 免密码登陆)[1 生成秘钥对,一路回车就好](#<strong>1 生成秘钥对,一路回车就好</strong>)
[2 修改公钥名称为authorized_keys](#<strong>2 修改公钥名称为authorized_keys</strong>)
[3 修改权限为600](#<strong>3 修改权限为600</strong>)
[4 修改sshd配置文件](#<strong>4 修改sshd配置文件</strong>)
[5 重启sshd服务](#<strong>5 重启sshd服务</strong>)

配置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 到任意地方保存即可实行无密码登陆

相关文章

  • 配置Linux免密码登陆

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

  • linux ssh 免密登陆排查技巧

    场景: 使用ssh免密登陆配置的时候。做了相关配置之后,尝试ssh免密登陆,还是提示输入密码,无法免密登陆。也没有...

  • linux下常用的批量处理脚本

    目的:在管理多个linux主机时,为了方便运维和使用,我们一般都会打通主机之间的ssh免密码登陆。在主机之间免密码...

  • linux免密码登陆

    生成密钥 公钥上传到服务器 登录服务器,公钥保存为authorized_keys 配置本地ssh config文件...

  • ssh免密设置

    场景说明 有2台Linux机器A和B,想要配置A登陆到B上免输入密码 在A上生成公钥 将A上生成的公钥id_rsa...

  • SSH免密码登录设置

    在Hadoop等应用,通常要设置SSH免密码登录来管理集群。这里记录一下Linux配置免密码登录设置。 安装SSH...

  • MAC小技巧--sudo免密

    Mac/Ubuntu/Linux 配置sudo免密码只需要如下两部: 1.修改文件权限,可读写 2.配置修改账户免...

  • Storm | 集群部署

    集群部署 环境准备 ssh免密码登陆、zookeeper 部署、python 2.7+ 集群部署 常用配置 启动服...

  • ssh免密码登陆及其原理

    [TOC] ssh免密码登陆及其原理 1 示例 ssh 无密码登录要使用公钥与私钥。linux下可以用用ssh-k...

  • ssh免密登陆linux服务器&别名登陆

    鉴于在终端登陆linux服务器,每次都要输入用户名,IP和密码,甚麻烦。故利用ssh免密登陆以及利用别名登陆。 一...

网友评论

    本文标题:配置Linux免密码登陆

    本文链接:https://www.haomeiwen.com/subject/txterttx.html