首页 技术 正文
技术 2022年11月12日
0 收藏 533 点赞 3,742 浏览 1257 个字

SSH免密登录配置

本地生成密钥文件:

$ ssh-keygen

输出:

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa): 直接enter

Enter passphrase (empty for no passphrase): 继续直接按enter

Enter same passphrase again: 继续直接按enter

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:

10:98:86:e7:78:c8:24:87:dc:3a:8a:30:ca:08:4e:8c root@min1

The key’s randomart image is:

+–[ RSA 2048]—-+

|…. o.          |

|o.+.=  .         |

|o=.*  .          |

|E=+ o  .         |

|@…    S        |

|=o               |

|                 |

|                 |

|                 |

+—————–+

出现上面情况表示key生成成功,放在了root/.ssh/id_rsa文件中,无密码。

将key文件拷贝到目标机

$ ssh-copy-id 192.168.71.10

输出:

The authenticity of host ‘192.168.71.10 (192.168.71.10)’ can’t be established.

RSA key fingerprint is fa:a9:1b:a8:d3:f8:4b:39:23:c6:4b:e6:21:c1:df:99.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added ‘192.168.71.10’ (RSA) to the list of known hosts.

root@192.168.71.10’s password: 输入目标机192.168.71.10密码

Now try logging into the machine, with “ssh ‘192.168.71.10’”, and check in:

.ssh/authorized_keys

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

至此表示拷贝成功了,输出说可以尝试登陆了。

登陆测试

[root@min1 ~]$ ssh 192.168.71.10

Last login: Wed Nov 22 00:58:34 2017 from 192.168.71.1

[root@min2 ~]$ ^C

这样就可以远程运行脚本及操作各种指令了。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,489
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,904
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,737
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,490
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,128
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,291