ssh 免登录
场景:
jenkins 需要自动登陆到远程服务器
1. 生成 ssh 公钥和私钥(在 jenkins 服务器上执行)
xiluhua@vm-xiluhua ~ $ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/xiluhua/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/xiluhua/.ssh/id_rsa.
Your public key has been saved in /home/xiluhua/.ssh/id_rsa.pub.
The key fingerprint is:
4f::::ac:5d::ed:b2::de:8d:9f:eb:: xiluhua@vm-xiluhua
The key's randomart image is:
+--[ RSA ]----+
| ..oo.. |
| oo.o .|
| o.o . |
| .o. . .|
| S o o o |
| o o . |
| .. . o |
| . oE=|
| .**|
+-----------------+
2. 查看生成结果
xiluhua@vm-xiluhua ~ $ cd /home/xiluhua/.ssh/
xiluhua@vm-xiluhua ~/.ssh $ ll
总用量
-rw-------. xiluhua xiluhua // :: id_rsa
-rw-r--r--. xiluhua xiluhua // :: id_rsa.pub
-rw-r--r--. xiluhua xiluhua // :: known_hosts
3. 将公钥部署到目标客户端(一)
xiluhua@vm-xiluhua ~/.ssh $ ssh-copy-id -i id_rsa.pub loginuser@10.1.118.45
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: key(s) remain to be installed -- if you are prompted now it is to install the new keys
xiluhua@192.168.178.132's password: Number of key(s) added: Now try logging into the machine, with: "ssh 'loginuser@10.1.118.45'"
and check to make sure that only the key(s) you wanted were added.
3. 将公钥部署到目标客户端(二)
scp -p ~/.ssh/id_rsa.pub loginuser@10.1.118.45:/home/weblogic/.ssh/authorized_keys 实在不行,手动复制到目标机器上也可以
4. 验证
xiluhua@vm-xiluhua ~/.ssh $ ssh loginuser@10.1.118.45
Last login: Tue Jul 25 21:27:55 2017 from 192.168.178.1
******************************
*** welcome! xiluhua ***
******************************
xiluhua@localhost ~ $
return "SUCCESS";
ssh 免登录的更多相关文章
- 【mac】ssh免登录密码
mac ssh免登录密码 在mac或者Linux上需要使用ssh登服务器,每次都需要输密码感觉很麻烦,搜了一下找到一个脚本,实践后发现可行. 1.创建脚本xx.sh $ vim xx.sh 输入: # ...
- ssh 免登录配置
引子 近日海淘了一个 mini-PC:Gigabyte GB-BSRE-1605,此设备虽采用 amd 嵌入式低功耗处理器,性能相比现在自己所用的设备却有不小提升,加上先前升级电脑多余一些 ssd 和 ...
- centos 6.5 配置ssh免登录
生成密匙: ssh-keygen -t rsa 会生成 id_rsa id_rsa.pub id_rsa:私匙 id_rsa.pub:公匙 配置当前机器免登录: cp id_rsa.pub auth ...
- Linux SSH免登录配置总结(转)
转载请出自出处:http://eksliang.iteye.com/blog/2187265 一.原理 我们使用ssh-keygen在ServerA上生成私钥跟公钥,将生成的公钥拷贝到远程机器Serv ...
- GIT SSH免登录密码实现更新(git pull)、推送(git push)操作
一.使用场景 现在有两台服务器A和B,在A服务器上搭建有git版本代码仓库,现要实现B服务器SSH免密码登录A服务器,并能够从A服务器拉取.推送代码! 二.操作步骤 1.在B服务器项目根目录下执行以 ...
- Linux多台机器配置ssh免登录
.安装ssh. sudo apt-get install ssh. 安装完成后会在~目录(当前用户主目录,即这里的/home/xuhui)下产生一个隐藏文件夹.ssh(ls -a 可以查看隐藏文件). ...
- SSH免登录及原理
1.免登陆实现 1)在本机生成公钥/私钥对 ssh-keygen 执行成功后,在.ssh文件夹下,会多出两个文件 id_rsa和id_rsa.pub 2)将公钥写入远端服务器.ssh文件夹下的auth ...
- 【ssh免登录】设置集群环境ssh免登录步骤
1.每台机器都需要执行,生成自己的密钥 # ssh-keygen -t rsa 过程中遇到选项,全部enter #cd ~/.ssh # cat id_rsa.pub > authorized_ ...
- Linux配置SSH免登录
[root@Linux01 ~]# ssh-keygen #生成公私钥 [root@Linux01 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub hadoopuser@Ha ...
随机推荐
- SpringBoot 使用RedisTemplate操作Redis
新版: import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.T ...
- win7远程ubuntu桌面以及Ubuntu14.04安装搜狗输入法 Ubuntu远程登录windows系统
windows远程登录ubuntu有命令行以及桌面两种方式. 1.命令行的方式我认为putty这款软件比较好,这之前需要在ubuntu电脑上安装上ssh,命令如下(安装与启动): sudo apt-g ...
- 【雅思】【写作】【大作文】Discuss both views and give your own opinion
•Discuss both views and give your own opinion • • •Agree or disagree •Discuss both views •Report ...
- Perfmon——为什么“% Disk Time”计数器的值会大于100%?
最近在使用perfmon做性能测试时发现,“% Disk Time”计数器的值总是会大于100%.如下图所示. perfmon上对“% Disk Time”的中文描述为: % Disk Time 指所 ...
- python的运行机制
不需要生成二进制代码,python解释器把源码->字节码,然后在执行这些字节码. 解释器的具体工作: 1.完成模块(module)的加载和链接 2.将源代码编译成pyCodeObject(字节码 ...
- golang 与 c语言 之间传递指针的规则提案
https://go.googlesource.com/proposal/+/master/design/12416-cgo-pointers.md https://github.com/golang ...
- Scala的apply unapply unapplySeq 语法糖
apply 可以理解为注入 unapply unapplySeq 可以理解为提取 apply 与 unapply 虽然名字相近,但是使用起来区别挺大.apply有点像构造函数unapply主要是结合模 ...
- 微信小程序:wx.navigateBack页面返回传参
场景(比如:商城选地址,选优惠券): 在[页面A]中调用wx.navigateTo方法跳转到[页面B] 然后从[页面B]返回[页面A], 并将[页面B]中的一些数据传回[页面A] wx.navigat ...
- PHP学习路径及练手项目合集
PHP 技术路径中包含入门知识.PHP 编程基础.PHP Web 框架.项目实战和项目进阶五个模块.模块中的课程将带着你逐步深入,学会如何使用 PHP 实现项目一个博客,聊天室,MVC框架及搜索系统等 ...
- bat脚本简单命令
1.if 判断 (1.1)判断字符串是否为空: if "%var1%" == " " ( echo null) else(echo not null ) (1. ...