scp

scp 远程文件复制命令

瘦欲@ 提交于 2019-12-29 00:25:01
scp 远程文件复制工具 1.命令功能 scp用户在不同linux主机间复制文件,他采用ssh协议保障复制的安全性。scp复制是全量完整复制,效率不高,使用与第一次复制,增量复制建议rsync命令。 2.语法格式 scp option user@host1:file1 user@host2:file2 选项选项 选项选项说明 -C 压缩传输 -l 指定传输占用带宽,单位kbit/s -P port 指定传输的端口号 ***** -p 保留文件的源属性 ***** -q 不显示传输进度条 -r 递归复制整个目录 ***** 3.使用范例 示例1 推送功能 将本地文件复制到远端服务器 示例2 拉取功能 将远端服务器文件复制到本地目录 来源: https://www.cnblogs.com/joechu/p/9034187.html

cp & scp 文件复制

我怕爱的太早我们不能终老 提交于 2019-12-29 00:23:39
cp 使用权限:所有使用者 使用方式: cp [options] source dest cp [options] source... directory 说明:将一个档案拷贝至另一档案,或将数个档案拷贝至另一目录。 1.目标文件夹若存在,则复制进去,若是一个新的文件名或者 新的文件夹名,则将源文件(夹)改成新的名字。 2.源文件是文件夹时, 如果目标目录下面已经有一个同名的文件夹,那么会把源文件夹下的所有文件复制到已有的同名的那个文件夹下面。 选项 -a 尽可能将档案状态、权限等资料都照原状予以复制。 -r 若 source 中含有目录名,则将目录下之档案亦皆依序拷贝至目的地。 -f 若目的地已经有相同档名的档案存在,则在复制前先予以删除再行复制。 范例: 将档案 aaa 复制(已存在),并命名为 bbb : cp aaa bbb 将所有的C语言程式拷贝至 Finished 子目录中 : cp *.c Finished scp scp是有Security的文件copy,基于ssh登录。操作方便, 比如要把当前一个文件copy到远程另外一台主机上,可以如下命令。 scp /home/111.tar.gz 192.168.10.100:/home 然后会提示你输入另外那台 192.168.10.100 主机的root用户的登录密码,接着就开始copy了。 如果想反过来操作,

paramiko 模块 ---- python2.7

会有一股神秘感。 提交于 2019-12-28 17:24:24
模拟远程执行命令: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 import paramiko #设置日志记录 paramiko.util.log_to_file( '/tmp/test' ) #建立连接 ssh = paramiko.SSHClient() #缺失host_knows时的处理方法 ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #连接远程客户机器 ssh.connect( '10.1.6.190' ,port = 22 ,username = 'root' ,password = 'password' ,compress = True ) #获取远程命令执行结果 stdin, stdout, stderr = ssh.exec_command( 'hostname;uptime' ) print stdout.read()# 其中其他各类的提示在stderr, stdin中(如错误提示) #输出执行结果 ssh.close() 模拟远程文件传输: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 import paramiko

How does `scp` differ from `rsync`?

ε祈祈猫儿з 提交于 2019-12-28 04:38:32
问题 An article about setting up Ghost blogging says to use scp to copy from my local machine to a remote server: scp -r ghost-0.3 root@*your-server-ip*:~/ However, Railscast 339: Chef Solo Basics uses scp to copy in the opposite direction (from the remote server to the local machine): scp -r root@178.xxx.xxx.xxx:/var/chef . In the same Railscast, when the author wants to copy files to the remote server (same direction as the first example), he uses rsync : rsync -r . root@178.xxx.xxx.xxx:/var

linux使用scp传输文件 免密操作

让人想犯罪 __ 提交于 2019-12-27 17:21:27
从A主机scp文件到B主机 需要输入密码 将A主机的秘钥信息加入B主机的某个文件即可 第一步: 进入主机 的 .ssh文件夹 输入ssh-keygen -t rsa 一路回车 然后会在此文件下生产两个文件 第二步: 如图所示 将id_rsa.pub 放入B主机中的.ssh文件夹后 有authorized_keys文件则将此文件内容 追加到authorized_keys文件中 cat id_rsa.pub >> authorized_keys 否则新建 cat id_rsa.pub > authorized_keys 再在A主机进行scp文件到B主机时则不需要输入密码 结束 来源: CSDN 作者: 不会射雕的靖哥哥 链接: https://blog.csdn.net/weixin_41634885/article/details/103730949

Java SCP copy local file to remote implementation

半城伤御伤魂 提交于 2019-12-26 01:35:15
最近做的项目中,有一个小需求,需要通过SCP把本地文件copy到远程服务器。查了好多资料,最终解决方案简单快速,分享一下。 在这里,需要用到4个jar包,分别是ant-jsch.jar,ant-launcher.jar,ant.jar,jsch-0.1.52.jar。 前三个jar包,可以去http://ant.apache.org/bindownload.cgi下载最新的apache ant zip archive, 目前最新版本是 apache-ant-1.9.7-bin.zip 。解压之后,在lib文件夹下可以找到上述三个jar包。 jsch-0.1.52.jar可通过https://sourceforge.net/projects/jsch/下载。 把这几个jar包引入到项目中后,就可以用org.apache.tools.ant.taskdefs.optional.ssh.Scp来进行文件的网络传输了,代码如下: 1 Scp scp = new Scp(); 2 int portSSH = 22; 3 String srvrSSH = "bjcore-geda06.int.thomsonreuters.com"; 4 String userSSH = "oracle"; 5 String pswdSSH = "oracle"; 6 String localFile = "D

scp命令后台运行

情到浓时终转凉″ 提交于 2019-12-25 19:13:30
Linux scp 设置nohup后台运行 1.正常执行scp命令 2.输入ctrl + z 暂停任务 3.bg将其放入后台 4.disown -h 将这个作业忽略HUP信号 5.测试会话中断,任务继续运行不受影响 1.正常执行scp命令 从oradb30机器拷贝一个文件夹到oradb31机器: scp -r /u01/media/Disk1/ 192.168.1.31:/u01/media/. [root@oradb30 ~]# scp -r /u01/media/Disk1/ 192.168.1.31:/u01/media/ reverse mapping checking getaddrinfo for bogon failed - POSSIBLE BREAK-IN ATTEMPT! root@192.168.1.31's password: ... filegroup2.jar 100% 84KB 83.8KB/s 00:00 filegroup9.jar 2.输入ctrl + z 暂停任务 输入ctrl + z 暂停 [1]+ Stopped scp -r /u01/media/Disk1/ 192.168.1.31:/u01/media/ [root@oradb30 ~]# 此时查看jobs: [root@oradb30 ~]# jobs [1]+ Stopped

Using Volumerize to backup my docker volumes with scp ?

旧城冷巷雨未停 提交于 2019-12-25 12:42:33
问题 I have a couple of docker volumes i want to backup onto another server, using scp/sftp. I don't know how to deal with that so i decided to have a look at blacklabelops/volumerize GitHub project. This tool is based on the command line tool Duplicity. Dockerized and Parameterized for easier use and configuration. Tutorial is dealing with a jenkins docker, but i don't understand how to mention i'm want to use a pem file. I've tried different solution (adding -i option to scp command line)

Permission denied using ant and scp

不问归期 提交于 2019-12-25 04:53:27
问题 In my ant file, I scp a java war file to a test server. As soon as I switched over to java 1.7, due to project requirements, the ant file is throwing a permission denied error: BUILD FAILED C:\Users\jdoe\Documents\code\build2\projectName\build.xml:72: com.jcraf t.jsch.JSchException: java.net.SocketException: Permission denied: connect at com.jcraft.jsch.Util.createSocket(Util.java:344) at com.jcraft.jsch.Session.connect(Session.java:194) at com.jcraft.jsch.Session.connect(Session.java:162) at

Can I Use SCP using data piped from an unzip -p cmd?

穿精又带淫゛_ 提交于 2019-12-24 20:58:14
问题 We're using: Linux version 2.6.32-696.20.1.el6.x86_64 (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Fri Jan 12 15:07:59 EST 2018 x86_64 x86_64 x86_64 GNU/Linux I want to send data from one server to another using scp ( secure copy procedure). We're unzipping the data first. Also we're only unzipping the data and piping it (hence the unzip -p) to the server as opposed to unzipping to a file on the local server and then sending it. This is because the server is a producion