scp

How to upload/download files using apache SSHD ScpClient

女生的网名这么多〃 提交于 2021-02-16 20:21:47
问题 I don't know what I doing wrong in setting up a ScpClient to send/receive files. I am using Apache MINA SSHD library to start a SSH server and try to copy files to/from it. Here is my setup: SSHServer.java public class SSHServer { private SshServer sshServer; private static final Logger logger = LoggerFactory.getLogger(SSHServer.class); public SSHServer() { sshServer = SshServer.setUpDefaultServer(); sshServer.setHost("127.0.0.1"); sshServer.setPort(22); sshServer.setKeyPairProvider(new

Copy file via scp

╄→гoц情女王★ 提交于 2021-02-11 14:21:54
问题 I have two servers. server A and B . I have created user on server A script is here useradd --home-dir /opt/test --no-create-home --shell /opt/test/bin/test.sh --password XXXX test I want to connect server A from B via scp and copy file scp -t -t -r /opt/test/ test@192.168.0.52:/opt/test/ but throws exeption scp: ambiguous target I have read about this error.As I understood this is syntactic error but there is not such a problem Can anybody help me? 回答1: AFAIK scp has no option -t (see man

scp output as logfile

别说谁变了你拦得住时间么 提交于 2021-02-09 11:41:43
问题 I am relatively new to using scp - and I am trying to do some simple stuff over ec2 - something like the following: scp -i ec2key.pem username@ec2ip:/path/to/file ~/path/to/dest/folder/file What I would like to have is the log of the above command (i.e the screen output to a text file) - Is there a way to achieve this? Thanks. 回答1: You can redirect both outputs (stdout, stderr) of the command with &> provided you use the verbose ( -v ) argument. Otherwise, scp will suppress the output as it

could not copy file name with space in scp ssh

橙三吉。 提交于 2021-02-08 11:21:28
问题 I could not copy the file with spaces in file name using ssh2_scp_recv() function.This is the filename testfile-03_23_15 11 02 AM.csv which actually stored in server. my code is here if ($file == "testfile-03_23_15 11 02 AM.csv"){ if(!ssh2_scp_recv($connection,$remoteDir .$file, $localDir . $file)){ echo "Could not download: ", $remoteDir, $file, "\n"; } } Please help me if you know. Thanks. 回答1: With phpseclib: <?php include 'phpseclib/Net/SSH2.php'; include 'phpseclib/Net/SCP.php'; $ssh =

How to copy file from local vagrant to local system?

北战南征 提交于 2021-01-29 08:00:19
问题 I want to copy local.conf from local vagrant machine to local system(my machine). Vagrant is running on the same machine. I tried the following command. It run successfully, but when I search local.conf file on my system I get nothing. [vagrant@localhost devstack]$ scp vagrant@192.168.50.4:/home/vagrant/local.conf local.conf vagrant@192.168.50.4's password: local.conf 100% 3857 3.8KB/s 00:00 [vagrant@localhost devstack]$ 回答1: To copy files from host to vm (and vice versa) you do not

How can I fix my expect script for scp download?

左心房为你撑大大i 提交于 2021-01-29 05:42:55
问题 I am trying to use expect to bypass the password authentication process for a remote server I'm using, so I can download a series of files in bulk, each of which is stored in a different folder. The reason for using expect is the remote files are stored in separate folders, and the server I'm accessing won't allow me ssh key access. At present I am struggling to download a single file using expect, never mind numerous ones at once. Below is my simple script: #!/bin/bash #connect to the server

PHP Exec SCP does not copy the file to the remote server

会有一股神秘感。 提交于 2021-01-26 20:01:50
问题 I need a file from a server to another server (I own both) using PHP. I have the following script: <?php exec('scp /home/pat/file1.tst pat@myserver.com:/home/pat/file1.txt'); I get this error: Disallowed system call: SYS_pipe What is that error? and how can I fix it? 回答1: PHP environment does not allow exec on your server. 回答2: This is kinda late, I know, but you might have better luck with phpseclib's pure PHP SCP implementation: https://raw.github.com/phpseclib/phpseclib/master/phpseclib

Automate SCP with multiple files with expect script

老子叫甜甜 提交于 2021-01-21 04:39:45
问题 So I have seen multiple posts on this and maybe I just haven't seen the right one. I am using an expect script to scp multiple files from my locale to a remote. I dont want to set up keys for passwordless logins, because then the servers cant be blown away and stood up with out more work, yes I could automate the key creation, I would just rather not. So I want to be able to use the * but every time I use the * it tells me. The reason I want to use * instead of a full name is because the

redirect SCP output to file

血红的双手。 提交于 2020-12-07 18:44:47
问题 I've tried: scp -r file host:~/ 2>&1 | tee -a file.log scp -r file host:~/ >file.log 2>&1 scp -r file host:~/ &>file.log and i only ever get a blank file. what am I doing wrong? the goal is to capture the output of the files transferred to the text file 回答1: You can achieve this using script : script -q -c "scp -r file host:~/" > file.log 来源: https://stackoverflow.com/questions/32637393/redirect-scp-output-to-file

redirect SCP output to file

故事扮演 提交于 2020-12-07 18:37:19
问题 I've tried: scp -r file host:~/ 2>&1 | tee -a file.log scp -r file host:~/ >file.log 2>&1 scp -r file host:~/ &>file.log and i only ever get a blank file. what am I doing wrong? the goal is to capture the output of the files transferred to the text file 回答1: You can achieve this using script : script -q -c "scp -r file host:~/" > file.log 来源: https://stackoverflow.com/questions/32637393/redirect-scp-output-to-file