linux-scp命令及如何设置免密登录
部署测试环境时经常在两台服务器间copy文件,那么如何设置免密登录?
场景:源服务器A(如172) -> 目标服务器B(如71) 实现将服务器A的文件copy到服务器B
实现方式有两种:
在源服务器A(172)上执行:若两台服务期间已设置免密登录(绿色字体是设置免密登录),那么只需要执行下述红色命令
首先运行命令 ssh-keygen 根据提示一路回车即可
[yyuser@hlyy .ssh]$ ssh-copy-id chenjl@10.1.1.71
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/yyuser/.ssh/id_rsa.pub"
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: key(s) remain to be installed -- if you are prompted now it is to install the new keys
chenjl@10.1.1.71's password: Number of key(s) added: Now try logging into the machine, with: "ssh 'chenjl@10.1.1.71'"
and check to make sure that only the key(s) you wanted were added. [yyuser@hlyy home]$ ll
total
-rw-r--r-- root root Sep : a.txt
drwx------ yyuser yyuser Sep : yyuser
[yyuser@hlyy home]$ scp -r a.txt chenjl@10.1.1.71:/home/py
a.txt % .0KB/s :
在目标服务器B(71)上执行:若两台服务期间已设置免密登录(绿色字体是设置免密登录),那么只需要执行下述红色命令
首先执行命令ssh-keygen 根据提示一路回车即可
[chenjl@ipha-dev71- .ssh]$ ssh-copy-id yyuser@10.1.1.172 #将公钥添加到172
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/chenjl/.ssh/id_rsa.pub"
/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
yyuser@10.1.1.172's password:
/home/yyuser/osinfo.sh: line : lspci: command not found Number of key(s) added: Now try logging into the machine, with: "ssh 'yyuser@10.1.1.172'"
and check to make sure that only the key(s) you wanted were added. [chenjl@ipha-dev71- .ssh]$ scp yyuser@10.1.1.172:/home/a.txt /home/py
/home/yyuser/osinfo.sh: line : lspci: command not found
a.txt
linux-scp命令及如何设置免密登录的更多相关文章
- Linux 下配置 hosts 并设置免密登录
Linux 下配置 hosts 并设置免密登录 作者:Grey 原文地址: 博客园:Linux 下配置 hosts 并设置免密登录 CSDN:Linux 下配置 hosts 并设置免密登录 说明 实现 ...
- windows使用vscode设置免密登录linux服务器
秘钥原理解释 id_rsa.pub是公钥,部署在服务器上 id_rsa是私钥,放在windows本地 本质上它们都是个文本文件 操作流程 生成秘钥对(windows和linux均可) ssh-keyg ...
- linux(十)配置ssh免密登录实现
知道ssh的朋友应该知道它是用来干什么的,如果你不知道什么是ssh远程登录的话,可以去看一下我的上一篇博客,关于linux的网络基础的知识.备注:ssh是用于远端登入.执行ssh指令开启终端机阶段作业 ...
- Hadoop完全分布式环境搭建(二)——基于Ubuntu16.04设置免密登录
在Windows里,使用虚拟机软件Vmware WorkStation搭建三台机器,操作系统Ubuntu16.04,下面是IP和机器名称. [实验目标]:在这三台机器之间实现免密登录 1.从主节点可以 ...
- 【Linux】两台服务器ssh免密登录
背景: 有些场景可能用到两台服务器ssh免密登录.比如服务器自动化部署 开始准备: 服务器A linux ip: 192.168.1.1 服务器B linux ip: 192.168.1. ...
- 在linux服务器以及客户端实现公钥免密登录
每次登录服务器都要输入密码,这点比较麻烦.使用ssh公钥登录机制可以直接登录,避免每次都输入密码的烦恼. 所谓ssh公钥登录机制即是:客户端电脑client产生加密用的公钥id_rsa.pub与私钥i ...
- Linux的SSH免密登录(一)
1.从cp/scp命令出发 scp(secure copy)是linux系统下基于ssh登录进行安全的远程文件拷贝的命令. 1. 传递文件到远程 scp local_file remote_usern ...
- centos配置免密登录
一.准备工作 1.先准备两台centos机器.例如:192.168.1.100和192.168.1.101两台机器,配置101免密登录100 2.默认centos会自带ssh和stfp,机器未安装,请 ...
- Ubuntu如何配置SSH免密登录
前言 在搭建hadoop集群时,需要主机和副机之间实现SSH免密登录 一.环境准备 1.ubuntu两台 二.安装SSH 1.首先检测一下本机有没有安装SSH服务,如果没有任何打印说明未安装 sudo ...
随机推荐
- PTA A1001&A1002
从今天起每天刷1-2题PAT甲级 第一天 A1001 A+B Format (20 分) 题目内容 Calculate a+b and output the sum in standard forma ...
- 19 (OC)* RunLoop
面试题 1:讲讲RunLoop,项目中有用到吗? 2:RunLoop内部实现逻辑? 3:Runloop和线程的关系? 4:timer 与 Runloop 的关系? 5:程序中添加每3秒响应一次的NST ...
- C++中类型强制转换
C++中强制类型转换有四种: 1.static_cast 格式:static_cast<Type>(Value); --用于基本类型间的转换,但不能用于基本类型指针间的转换: int i ...
- 用Python怎么SSH到网络设备
0. 前言 自上一篇文章<用python怎么telnet到网络设备>,简单使用了telnetlib库给大家演示了下,但是,现实环境中仍不建议去使用telnet. SSH(Secure Sh ...
- 深入理解perf报告中的swapper进程
一.前言 1.在perf监控进程的系统调用时,会出现大量swapper进程 2.官方描述该进程是当CPU上没有其他任务运行时,就会执行swapper.换句话说swapper意味着CPU啥事也没干,跑去 ...
- C语言入门-指针
终于到了精髓的地方了,这确实有点懵,总感觉这太麻烦了,而且写着也不爽,还是怀念py或者java,但也没办法,还是要继续学下去. 一.运算符& scanf("%d" , &a ...
- Build step 'Invoke top-level Maven targets' marked build as failure Finished解决
最近用法 jenkins部署maven项目时候,突然出现Build step 'Invoke top-level Maven targets' marked build as failure Fini ...
- Python数据结构 - 利用headp模块寻找最大N个元素并实现优先队列
用headp找到最大最小的N个值 import heapq nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2] print(heapq.nlargest(3, ...
- RocketMQ初入门踩坑记
本文主要是讲在Centos中安装RocketMQ并做简单的示例.如果你按照本文安装100%是可以成功的,如果按照阿里官方的说明,那只能呵呵了~ 安装 官方地址为:https://rocketmq.ap ...
- 自适应布局display:-webkit-box的用法
在web布局中,我们经常使用的是display:inline-block,display:flex,这些,但其实在进行移动端设备自适应布局中,-webkit-box布局更加合适 不同的浏览器有不同的前 ...