scp

equivalent of ftp put and append in scp

北城以北 提交于 2019-12-09 05:23:14
问题 I have a legacy script which I am not able to understand. The script is to transfer 4 files (2 ebcdic format files and 2 pdf files) in unix to mainframes through ftp. ebcdic format file 1 is abc.xyz ebcdic format file 2 is pqr.xyz pdf file 1 is abc.pdf pdf file 2 is pqr.pdf mainframe file name is AM2P.BJCUN.SALCHG The syntax of the command in the script is as below: quote site recfm=fb put /myfiles/abc.xyz AM2P.BJCUN.SALCHG append /myfiles/abc.pdf AM2P.BJCUN.SALCHG append /myfiles/pqr.xyz

Linux下scp的用法

自作多情 提交于 2019-12-08 19:41:31
scp 对拷文件夹 和 文件夹下的所有文件 对拷文件并重命名 对拷文件夹 (包括文件夹本身) scp -r /home/wwwroot/www/charts/util root@192.168.1.65:/home/wwwroot/limesurvey_back/scp 对拷文件夹下所有文件 (不包括文件夹本身) scp /home/wwwroot/www/charts/util/* root@192.168.1.65:/home/wwwroot/limesurvey_back/scp 对拷文件并重命名 scp /home/wwwroot/www/charts/util/a.txt root@192.168.1.65:/home/wwwroot/limesurvey_back/scp/b.text Linux下scp的用法 scp就是secure copy,一个在linux下用来进行远程拷贝文件的命令。 有时我们需要获得远程服务器上的某个文件,该服务器既没有配置ftp服务器,也没有做共享,无法通过常规途径获得文件时,只需要通过简单的scp命令便可达到目的。 一、将本机文件复制到远程服务器上 #scp /home/administrator/news.txt root@192.168.6.129:/etc/squid /home/administrator/ 本地文件的绝对路径

JSch scp without known_host file and with StrictHostKeyChecking

家住魔仙堡 提交于 2019-12-08 12:37:01
问题 I am trying to copy some files from a Windows machine to a Linux machine, which is working fine with JSch so far. I can copy files using StrictHostKeyChecking no or I need to have the known_host file from the Linux machine I copy to. I am using the code for a Java project which should be able to send files automatically to (unknown) Linux machines. I got the username, password, IP and the publickey for the machine. Is there any way to authenticate without the known_host file and via the

Catching errors in SCP or SFTP

让人想犯罪 __ 提交于 2019-12-08 06:45:57
问题 I am writing a script that will transfer a file from one server to another using SCP or SFTP. It is very important for me to differentiate between different types of errors that occur. My problem, is that the error code returned from SFTP and (especially) SCP does not seem to distinguish between different types of errors. For example, when SCP-ing, it seems as if I get an error code of 1, no matter what type of error is actually occurring (ex: perrmission denied, could not connect to host

Scp file with jsch gives 'unexpected filename'

你。 提交于 2019-12-08 04:21:43
问题 I'm using Jsch 0.1.44 to scp a file from one host to another. The relevant code is the following: public boolean transferFileToHost(File fileToTransfer, String destDirectory, String destFilename) { Channel channel = null; try { String command = "scp -t "+ destDirectory + destFilename; channel = session.openChannel("exec"); ((ChannelExec)channel).setCommand(command); OutputStream out = channel.getOutputStream(); InputStream in = channel.getInputStream(); if(!connectToChannel(channel, in)) {

Adding Support for SCP and SFTP for Curl on Linux

≡放荡痞女 提交于 2019-12-08 04:09:05
问题 I've been been desperately trying to add SFTP and SCP support for Curl on my CentOS box. I found something resembling a solution here: http://andrewberls.com/blog/post/adding-sftp-support-to-curl I followed these steps but found that when attempting to get a file via both SCP and SFTP, the connection hangs once the file has been found. I cannot fix this and cannot find an alternative solution. I have to use Curl for a job at work and therefore cannot use another lib. Has anyone managed to

SSH/SCP through Paramiko with key in string

社会主义新天地 提交于 2019-12-07 18:03:20
问题 I got a great Paramiko Python script to transfer file over SCP protocol. But My need is a single file (script.py) without any other file dependencies so I don't want to have an external file for my SSH private key. What I'm trying to do is to embed the private key into a string variable and use this variable as the file needed by the script to connect. I tried with the StringIO library but it doesn't seems to work : hostname = '1.1.1.1' # remote hostname where SSH server is running port = 22

Mac 使用SSH远程登录

孤街浪徒 提交于 2019-12-07 15:48:23
一、打开ssh Mac Terminal是自带SSH的,可以用whereis来看看: $ whereis ssh 但是在现有进程中找不到ssh对应的进程: $ ps aux | grep ssh apple 25927 0.0 0.0 2432784 616 s000 R+ 3:14下午 0:00.00 grep ssh 直接用ssh命令连接本地主机或远程主机时会遇到下列错误提示: ssh: connect to host localhost port 22: Connection refused 谷歌了一下,原因在于系统设置中没有打开远程登录,参见: How do I open port 22 in osx 10.6.7 解决方法: 打开系统偏好设置 —— 共享,选中远程登录: 输入ssh localhost来测试一下,如果提示输入密码来认证就没问题了。 此时再grep一下进程可以看到ssh进程在运行了: $ ps aux | grep ssh apple 4656 0.0 0.0 2525056 1540 ?? S 三02下午 0:00.19 /usr/bin/ssh-agent -l apple 26009 0.0 0.0 2432784 612 s000 R+ 3:19下午 0:00.00 grep ssh 二、ssh和scp 接下来可以通过ssh命令来连接其它主机,例如:

can i know abt the exit status of the scp command in unix

笑着哭i 提交于 2019-12-07 14:21:14
问题 while doing the programing in perl with scp command i am stucked with facing the exit status of scp command if you tell which exit value(other then 0-success,1-error) is for what my life will be simple 回答1: From here: 0 Operation was successful 1 General error in file copy 2 Destination is not directory, but it should be 3 Maximum symlink level exceeded 4 Connecting to host failed. 5 Connection broken 6 File does not exist 7 No permission to access file. 8 General error in sftp protocol 9

Python: Execute scp, stdin for password not working

僤鯓⒐⒋嵵緔 提交于 2019-12-07 12:40:36
I'm trying the following from subprocess import Popen, PIPE Popen(["scp", "-B","user@url:file", "."], stdin=PIPE, shell=False).communicate(input="password") But I still get the password promt, and no password is sent. I know I can use scp with keys, but this is not what I need. Any help? scp interacts with the terminal directly, rather than reading from STDIN , You can't pass the password via a pipe, it security matter for scp and it's the same for sftp, ssh. you can try it in you terminal like this (and it will not work): echo "password" | scp me@localhost:test . As others have said, scp (and