scp

How to best capture and log scp output?

青春壹個敷衍的年華 提交于 2019-12-18 18:53:11
问题 I am trying to capture output from an install script (that uses scp) and log it. However, I am not getting everything that scp is printing out, namely, the progress bar. screen output: Copying /user2/cdb/builds/tmp/uat/myfiles/* to server /users/myfiles as cdb cdb@server's password: myfile 100% |*****************************| 2503 00:00 log output: Copying /user2/cdb/builds/tmp/uat/myfiles/* to server /users/myfiles as cdb I'd really like to know that my file got there. Here's what I am

scp a folder to a remote system keeping the directory layout

风格不统一 提交于 2019-12-18 15:11:49
问题 I have a large directory tree with hundreds of nested sub-folders. I need to copy only 4 folders and their contents to a remote system, but I need to destination folder structure to be kept the same. E.G. ./test/sub1/subsub1/hello.txt ./test/sub1/subsub2/hello2.txt ./test/sub2/hello3.txt I want to copy ./test/sub1/subsub1/* to a target such as user@system:~/test/sub1/subsub1/* but I do not want to copy subsub2 or sub2. I have tried using scp as follows: scp -r ./test/sub1/subsub1 me@my-system

scp a folder to a remote system keeping the directory layout

不想你离开。 提交于 2019-12-18 15:09:57
问题 I have a large directory tree with hundreds of nested sub-folders. I need to copy only 4 folders and their contents to a remote system, but I need to destination folder structure to be kept the same. E.G. ./test/sub1/subsub1/hello.txt ./test/sub1/subsub2/hello2.txt ./test/sub2/hello3.txt I want to copy ./test/sub1/subsub1/* to a target such as user@system:~/test/sub1/subsub1/* but I do not want to copy subsub2 or sub2. I have tried using scp as follows: scp -r ./test/sub1/subsub1 me@my-system

Ant scp task not working, even with jsch on ant/lib

試著忘記壹切 提交于 2019-12-18 12:52:21
问题 I need to copy a war file via scp. I have added the jsch-0.1.42.jar to $ANT_HOME/lib but I'm still getting this error: Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found. This looks like one of Ant's optional components. This is the result of running ant -diagnostics just in case: http://gist.github.com/320859 回答1: This looks like your problem, from the top of the diagnostics: optional tasks : not available Your $ANT_HOME/lib directory is missing ant-jsch.jar, which

WinSCP connect to Amazon AMI EC2 Instance changing user after login to “root”

人走茶凉 提交于 2019-12-18 12:28:29
问题 I followed instructions here carefully however I haven't get this working right. Here is what I did: Run WinSCP enter Hostname (Elastic IP of my Instance) enter username "ec2-user" enter public key file chose SCP for the protocol Under SCP/Shell settings I chose "sudo su -" Hit Login WinSCP asks me for passphrase key, Hit OK Shows up this error Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended). NOTE: This works on Putty 回答1: WinSCP

Ubuntu下ssh服务器文件操作命令

蓝咒 提交于 2019-12-18 08:00:28
SSH是一种以安全、加密方式连接远程主机或服务器的方法。SSH服务器接受从有SSH的客户机的连接,允许操作者象在本地一样地登录系统。你可以用SSH从远程运行shell和X程序。 (1)安装SSH服务器 加入Universe和Multiverse源后,用新立得安装ssh和openssh-server: 网络 > ssh 网络 > openssh-server (1) 用SSH登录远程ubuntu主机 假设远程Ubuntu主机安装了SSH服务器。远程Ubuntu主机的IP为:192.168.0.1 我们在命令行输入一下命令来连接: ssh username@192.168.0.1 (2) 从远程ubuntu主机拷贝文件/文件夹到本地(scp) 假设远程Ubuntu主机安装了SSH服务器。远程Ubuntu主机的IP为:192.168.0.1,远程文件夹位置为:/home/username/remotefile.txt 本地保存目录为:. (当前目录) 在命令行输入一下命令: scp -r username@192.168.0.1:/home/username/remotefile.txt . (3) 从本地向远程ubuntu主机拷贝文件/文件夹(scp) 假设远程Ubuntu主机安装了SSH服务器。远程Ubuntu主机的IP为:192.168.0.1,本地文件夹位置为:localfile

python copy file in local network (linux -> linux) and output

被刻印的时光 ゝ 提交于 2019-12-18 07:12:41
问题 I'm trying to write a script to copy files in my RaspberryPi, from my Desktop PC. Here is my code: (a part) print "start the copy" path_pi = '//192.168.2.2:22/home/pi/Stock/' file_pc = path_file + "/" + file print "the file to copy is: ", file_pc shutil.copy2(file_pc, path_pi + file_pi) Actually I have this error: (in french) IOError: [Errno 2] Aucun fichier ou dossier de ce type: '//192.168.2.2:22/home/pi/Stock/exemple.txt' So, how could I proceed? Must I connect the 2 machines before trying

sending a large file with SCP to a certain server stalls at exactly 2112 kB

筅森魡賤 提交于 2019-12-17 22:31:55
问题 There is a certain ubuntu 10.04 server where if I ssh a file onto it from any server that is outside the office where this server is (meaning any of use scp-ing onto this server through LAN from within this server always works for some reason), then scp-ing fails for any file over 2112 kB in size, and is stuck at 2112 kB. So scp -vvv /home/attila-szeremi/aszeremi.tar.gz attila@server.hu:~/aszeremi.tar.gz shows something like 1% 2112KB 909.2KB/s - stalled - dynamically at the end, where the KB

MySQL数据库定时备份Shell脚本

余生颓废 提交于 2019-12-17 22:01:14
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 这是一个简单的MySQL数据库备份 shell 脚本,适用于单台 Linux 服务器或者VPS的mysql数据库备份工作, 工作原理是使用mysql的mysqldump工具来导出数据库为.sql文件,然后将所有导出的文件打包归档。 然后我们在shell脚本中使用 scp命令把备份文件复制到另外一台备份机器,由于scp每次传送文件要密码 因此我们需要使用 expect插件 或者利用密钥。在这里介绍采用生成密钥对的方法。 1,生成密匙对,我用的是rsa的密钥。使用命令 "ssh-keygen -t rsa" 生成的过程中提示输入密钥对保存位置及密码,直接回车,接受默认值就行了。 其中公共密钥保存在 ~/.ssh/id_rsa.pub,私有密钥保存在 ~/.ssh/id_rsa 。 2,然后修改 .ssh 目录权限,chmod 755 ~/.ssh 。最后把 公共密钥复制到你要访问 的机器上去,并保存为: ~/.ssh/authorized_keys 。 scp -P 1110 ~/.ssh/id_rsa.pub daniel@*.*.*.*:/home/daniel/.ssh/authorized_keys (注意这里- P 为大写, 表示目标机器daniel 的ssh端口为1110,小写的p为源ssh端口,

scp or sftp copy multiple files with single command

送分小仙女□ 提交于 2019-12-17 17:23:43
问题 I'd like to copy files from/to remote server in different directories. For example, I want to run these 4 commands at once. scp remote:A/1.txt local:A/1.txt scp remote:A/2.txt local:A/2.txt scp remote:B/1.txt local:B/1.txt scp remote:C/1.txt local:C/1.txt What is the easiest way to do that? 回答1: Copy multiple files from remote to local: $ scp your_username@remote.edu:/some/remote/directory/\{a,b,c\} ./ Copy multiple files from local to remote: $ scp foo.txt bar.txt your_username@remotehost