ssh免秘钥登录

SSH免秘钥登录

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责

[[email protected] ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):    直接回车
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:
25:4b:57:51:1a:fc:c8:73:a8:6d:c9:a1:89:4a:29:90 [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
| .+o. |
| ..o |
| . o o..+ |
| E . = * o |
| . .S. * = |
| . o . + = |
| o . . |
| . |
| |
+-----------------+

[[email protected] ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.115.81
[email protected]‘s password:
Now try logging into the machine, with "ssh ‘192.168.115.81‘", and check in:

.ssh/authorized_keys

to make sure we haven‘t added extra keys that you weren‘t expecting.

[[email protected] ~]# ssh 192.168.115.81
Last login: Sat Sep 30 07:33:13 2017 from 192.168.115.118
[[email protected] ~]# ifconfig

...

eth1 Link encap:Ethernet HWaddr 00:0C:29:33:36:3F

inet addr:192.168.115.81 Bcast:192.168.115.255 Mask:255.255.255.0
...

时间: 2024-10-11 23:48:04

ssh免秘钥登录的相关文章

linux系统下ssh免秘钥登录

我有两台linux主机: 主机名分别是: lsx01.com lsx02.com 希望在lsx01.com这台主机上无秘钥登录lsx02.com. 一.修改hosts文件 在两台机器上都添加主机ip信息 例如在lsx01.com上: vi /etc/hosts 配置如下: 二.生成rsa秘钥文件,统一拷贝至一个authorized_keys中 1.在所有主机上,例如lsx01.com主机上生成rsa秘钥文件 cd /root/.ssh ssh-keygen -t rsa 三下回车 生成了两个文件

ssh免秘钥登陆实现

1.用处 搭建集群或者工作中登陆跳板机经常需要做免秘钥互相登陆彼此服务器. 2. 准备工作   假设A主机10.20.0.1想通过ssh登录到B主机10.20.0.2上.   那么客户端(A主机)需要安装ssh客户端软件,服务器端(B主机开机sshd进程)需要安装ssh服务器软件.   ssh客户端Linux发行版一般都自带的,对于ssh服务器端,Ubuntu用户可以sudo apt-get install openssh-server来安装,其他Linux用户也安装openssh-server

配置SSH使用秘钥登录

使用密码远程登录ssh还是有比较大的风险的,比较安全的方法是使用秘钥登录 配置步骤如下 首先生成秘钥 ssh-keygen  (直接默认回车也可以,生成的秘钥和公钥默认防止在/root/.ssh/文件夹下) 还需要执行以下操作(相当于在服务器端注册公钥,然后客户端使用私钥连接即可) cd /root/.ssh;cat id_rsa.pub >> authorized_keys chmod 600 authorized_keys chmod 700 ~/.ssh 然后配置ssh的配置文件/etc

设置SSH仅秘钥登录,禁止密码登录

/etc/ssh/sshd_config # $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin # T

免秘钥登录命令

#ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa 生成秘钥 #cd ~/.ssh/ id_dsa id_dsa.pub known_hosts id_dsa 私钥(给自己用) id_dsa.pub(给别人用) 把公钥文件追加到本地的认证文件中去 #cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys 就可以免密码登录 #scp ./id_dsa.pub [email protected]:/opt 把node1里的公钥

centos7-ssh免秘钥登录

实验环境: 主机1:controller    ip:192.168.1.10 主机2:compute      ip:192.168.2.10 controller主机执行ssh-keygen -t rsa生成秘钥 查看秘钥是否生成 compute主机执行ssh-keygen -t rsa生成秘钥 controller主机给compute主机分发公钥:scp .ssh/id_rsa.pub 192.168.1.20:/root/.ssh/authorized_keys controller主机

免秘钥登录总结

1.使用ssk-keygen生成秘钥 2.手动生成authorized_keys文件 3.将公钥复制到authorized_keys文件中, 命令:cat id_rsa.pub >> authorized_keys 4.生成known_hosts文件 5.编辑known_hosts文件,根据格式为主机名,ip,公钥添加(别忘了localhost) 6.将.ssh复制到其他主机上

ssh 无秘钥登录

三台centos 一台服务器192.168.2.152 一台客户端192.168.2.142 一台客户端192.168.2.151 (1)产生无密钥 [[email protected] ~]#  ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/root/.ssh/id_dsa): Enter passphrase (empty for no passp

ssh无秘钥登录

客户端保留私钥端: 1.创建目录 mkdir -p ~/.ssh 2.执行命令 ssh-keygen -t dsa 一路回车 3.把公钥推到服务器端 rsync -avz -e "ssh -p 指定端口" ~/.shh/id.dsa.pub [email protected]:~/.ssh/authorized_keys 4.修改权限 chmod 700 ~/.ssh chmod 600 id.dsa.pub chmod 600 authorized_keys 客户端与服务端权限必须一