scp

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

我们两清 提交于 2019-11-29 12:14:00
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 to copy? I have tryed with: path_pi = r'//192.168.2.2:22/home/pi/Stock' But the problem is the same.

JSch SCP file transfer using “exec” channel

[亡魂溺海] 提交于 2019-11-29 11:56:55
I'm very new to the SCP protocol and JSch. I have to transfer a file fro a remote device via SCP to Android. The server side developers refused to tell be anything about their device except for the file location, and the root account which can be used to access it with SCP. Here are the steps I tried. Confirm that using JSch, my Android client can establish connection with the server. [complete] Confirm that using JSch, and the ChannelExec object, I can send the ls command and read its output. [complete] Confirm that using JSch, and the ChannelSFTP object, I can transfer a file from the device

Getting stty: standard input: Inappropriate ioctl for device when using scp through an ssh tunnel

别等时光非礼了梦想. 提交于 2019-11-29 10:47:49
问题 Per the title, I'm getting the following warning when I try to scp through an ssh tunnel. In my case, I cannot scp directly to foo because port 1234 on device foo is being forwarded to another machine bar on a private network (and bar is the machine that is giving me a tunnel to 192.168.1.23). $ # -f and -N don't matter and are only to run this example in one terminal $ ssh -f -N -p 1234 userA@foo -L3333:192.168.1.23:22 $ scp -P 3333 foo.py ubuntu@localhost: ubuntu@localhost's password: stty:

How can I scp a file with a colon in the file name?

。_饼干妹妹 提交于 2019-11-29 10:39:01
问题 I'm trying to copy a file using scp in bash with a colon ( : ) character in the source filename. The obfuscated version of my command I'm using is: scp file\:\ name.mp4 user@host:"/path/to/dest" I get this error: ssh: Could not resolve hostname Portal 2: Name or service not known I know I could just rename the file and remove the : , but I'd like to know if it's possible to escape the colon. 回答1: Not quite a bash escaping problem, it's scp treating x: as a [user@]host prefix, try: scp ./file:

Copy file from chef client node to workstation

◇◆丶佛笑我妖孽 提交于 2019-11-29 08:05:28
I would like to know how to transfer a file from a client node to a remote machine. I have checked whether there any resource available for doing this. The closest thing I found is remote_file , but it is fetching a file from remote location and transfer it to the client node. So I tried another option by writing a bash script which will perform an automated scp. But I cant able to copy the file, but the chef-client was running fine without showing any errors. Here is my script for copying the file: #!/usr/bin/expect -f # connect via scp spawn scp "/tmp/testfile" chef-ws@10.232.110.113:/home

Using Mercurial, is there an easy way to diff my working copy with the tip file in the default remote repository

纵然是瞬间 提交于 2019-11-29 07:14:59
问题 When using mercurial, I'd like to be able to diff the working copy of a file with the tip file in my default remote repository. Is there an easy way to do this? I know I can do an "hg incoming -p" to see the patch sets of changes coming in, but it'd be nice to just directly see the actual changes for a particular file that I'd get if I do a pull of the latest stuff (or what I might be about put push out). The easiest thing I can think of right now is to create a little script that takes a

SCP for C# [closed]

南楼画角 提交于 2019-11-29 06:15:45
问题 Is there a library that provides the ability to do SCP transfers in C#? 回答1: Have you tried SharpSSH? (last update was 2013) 回答2: Use WinSCP .NET Assembly. It is really straight forward. 来源: https://stackoverflow.com/questions/651399/scp-for-c-sharp

How to respond to password prompt when using SCP in a shell script?

↘锁芯ラ 提交于 2019-11-29 04:13:22
First of all, I am well aware of that there are many of questions regarding this topic. I have read them, but still could figure out an appropriate answer for my situation. I would like to scp the entire ~/cs###/assign1 dir from local to school home dir with a shell script. My question is, is there a way in my script to wait for the password prompt, and then simulate key board event to 'type' in my password? here is a really detailed guide of how to set up the key Are ssh keys not allowed? That would be a better solution. Use "sshpass"! #!/bin/bash sshpass -p "password" scp -r /some/local/path

scp、rsync、xsync

回眸只為那壹抹淺笑 提交于 2019-11-29 03:30:43
scp、 拷贝完全相同 scp -r etc/hadoop/dfs.hosts root@192.168.121.134:/usr/local/hadoop/hadoop-2.7.6/etc/hadoop/    rsync、拷贝有差异的文件 rsync -rvl etc/hadoop/hdfs-site.xml root@192.168.121.136:/usr/local/hadoop/hadoop-2.7.6/etc/hadoop/    xsync、循环复制文件到所有节点相同的目录下 !/bin/bash #1获取输入参数个数,如果没有参数,直接退出 pcount=$# if((pcount==0)); then echo no args; exit; fi #2 获取文件名称 p1=$1 fname='basename $p1' echo fname=$fname 3 获取上级目录到绝对路径 pdir='cd -P $(dirname $p1); pwd' echo pdir=$pdir 4 获取当前用户名称 user='whoami' 5 循环 for((host=103; host<105; host++)); do echo ------------------- hadooppdir/user@hadooppdir done    来源: https://www