Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
2
answers
1932
views
SSH No route to host in local network after using rsync
So, this is my setup: I have computer A and a computer B, both with Ubuntu 20.01. Each computer has openssh-server working just fine. Yesterday, I used rsync to copy a large file from A to B, and it didn't seem to have any issue (it was the first time rsync was used). Today, I tried to connect via S...
So, this is my setup: I have computer A and a computer B, both with Ubuntu 20.01. Each computer has openssh-server working just fine. Yesterday, I used rsync to copy a large file from A to B, and it didn't seem to have any issue (it was the first time rsync was used). Today, I tried to connect via SSH from B to A and I had a "No route to host" error. Then I tried to connect via SSH from A to B and "No route to host" happened again. Then, on each computer I did a:
ssh user@127.0.0.1
and none gave me any issue. Then, I did a: ssh -T git@github.com
on both computers and both were successful. Then, I did an: nmap -Pn -p22 192.168.xx.yy
on both computers trying to connect to the other, the results are:
PORT STATE SERVICE
nmap tested in A with IP of A: 22/tcp filtered ssh
nmap tested in A with IP of B: 22/tcp open ssh
nmap tested in B with IP of A: 22/tcp filtered ssh
nmap tested in B with IP of B: 22/tcp open ssh
What really bugs me out is that yesterday, before using rsync, the ssh connection was working just fine. The file was copied successfully, and both computers have been restarted since, so I don't know if there's some file that was corrupted or something like that. I'm not even sure if the rsync is what caused the issue. Just to be sure, in computer A, I did a:
sudo lsof -i -P -n | grep 192.168
And the only IP address that I see is the one from A. Not sure if this might help, but I only used one rsync command, and is the one that follows:
rsync -rvz -e 'ssh -p XXXX' --progress /PATH/TO/SOURCE/FILE user@192.168.xx.yy:/PATH/TO/DESTINATION/FILE
EDIT: I don't think the path is the issue, since I ran rsync from a dicerctory in /home/user, but for disclosure, the actual rsnc command was:
rsync -rvz -e 'ssh -p 2222' --progress ./someDB.sql user@192.168.0.70:/home/user/DBs
And as for the absolute path of where I ran the command, it was:
/home/user/DB/
DanielUPPA
(1 rep)
Jan 12, 2021, 09:25 PM
• Last activity: Jul 29, 2025, 05:00 PM
0
votes
2
answers
1953
views
zip then transfer files from one server to another using scp or rsync
I have estimated 44 GB of data from my web server. I want to transfer it to another server with less time. I am using Putty to transfer file. is there any way to achieve this? I don't know which commands to use but some blogs said to use `rsync` or `scp` to transfer these files. your help is greatly...
I have estimated 44 GB of data from my web server. I want to transfer it to another server with less time. I am using Putty to transfer file. is there any way to achieve this? I don't know which commands to use but some blogs said to use
rsync
or scp
to transfer these files. your help is greatly appreciated. I've tried scp
from local to server but I what I need is from server to server.
Peter Eris
(1 rep)
Aug 10, 2021, 07:17 AM
• Last activity: Jul 12, 2025, 06:05 AM
1
votes
1
answers
64
views
rsync between two PCs which are both reverse SSH into a "jumpbox"?
Let us assume we have three computers (they are all running a modern linux distro) call one a jumpbox, and two others PCs: Jumpbox / \ / \ / \ PC1 PC2 **PC1 has a reverse ssh tunnel into jumpbox on port 39999** **PC2 has a reverse ssh tunnel into jumpbox on port 39998** *Jumpbox has no local disk sp...
Let us assume we have three computers (they are all running a modern linux distro) call one a jumpbox, and two others PCs:
Jumpbox
/ \
/ \
/ \
PC1 PC2
**PC1 has a reverse ssh tunnel into jumpbox on port 39999**
**PC2 has a reverse ssh tunnel into jumpbox on port 39998**
*Jumpbox has no local disk space to spare.*
**How do you setup an rsync over ssh to sync files from PC1:/myfiles to PC2:/myfiles?**
Note, currently the connections all work, with shared keys:
From jumpbox:
ssh localhost 39999 will get a login to PC1
ssh localhost 39998 will get a login to PC2
Tried and failed to accomplish this, from PC1, PC2 or even Jumpbox. From jumbox, tried to setup rsync but unsure how to specify ports for each destination. This page offers some insights, but does not seem to work. Also, the scp suggestion at the bottom does not specify ports (which would work, note you can do remote to remote copy, but not sure how to set a -P for each host?)
**Update, with temporary solution:**
After reading this page , and then this page , the scp + tar solution was tested and found to work from the jumbbox. Using some of tars features, although not as nice as rsync, gets the job done.
Just to note, rsync is not intended for rsync remotehost:/files remotehost2:files. I am not a windows user, but if jumpbox were windows based something like WinSCP would work, which I have seen previously. The basic solution can be found in "nortallys" answer on this stack exchange post . Basically:
ssh -p 39999 localhost 'tar -cf - /path/to/files/to/copy' |ssh -p 39998 localhost 'tar -xvpf - -C /'
This works for now, and switches to tar have been added to mimic rsync.
number9
(1112 rep)
May 25, 2025, 12:01 PM
• Last activity: May 27, 2025, 12:41 PM
7
votes
3
answers
3213
views
Tar piped to split piped to scp
So I'm trying to transfer a bunch of files via SCP. Some of these are too large to be stored on the recipient (Android phone, 4GB file size limit). The sender is almost out of space, so I can't create intermediate files locally. I'd like to tar up the bunch and stream it through split so that I can...
So I'm trying to transfer a bunch of files via SCP. Some of these are too large to be stored on the recipient (Android phone, 4GB file size limit).
The sender is almost out of space, so I can't create intermediate files locally.
I'd like to tar up the bunch and stream it through split so that I can get smaller segments that'll be accepted by the phone, i.e. local command:
tar -cvf - ~/batch/ | split --bytes=1024m - batch.tar.seg
But I'm not sure how I'd pipe that into scp to get it the phone. According the comment on [this post](http://gnuru.org/article/1522/copying-with-scp-stdin) , it's possible, but I first of all don't quite get what he's saying, second of all I'm not sure how to accomplish this as there'll be multiple files output from split.
Any ideas?
FlamingKitties
(5029 rep)
Feb 8, 2013, 07:06 AM
• Last activity: May 9, 2025, 10:53 AM
0
votes
1
answers
81
views
use scp to copy all files within directory -- NOT the directory -- to remote location
If you read all from post [How to copy all files from a directory to a remote directory using scp?](https://unix.stackexchange.com/q/232946/100397) you will find there is no answer that actually (as in ALWAYS) works, even though a (non)answer has a big green check mark. I have the following "solutio...
If you read all from post [How to copy all files from a directory to a remote directory using scp?](https://unix.stackexchange.com/q/232946/100397) you will find there is no answer that actually (as in ALWAYS) works, even though a (non)answer has a big green check mark.
I have the following "solution" but am asking whether someone knows a less cumbersome method.
1) Use "scp -r" to copy local_directory to remote_directory -- note that local_directory will be placed within remote_directory which is NOT desired but is easily fixed...
2) On remote machine create links within remote_directory to the files within remote_directory/local_directory -- I recommend the "find" command executing the "ln" command to accomplish this.
3) On remote machine use "rm -r remote_directory/local_directory" to remove unwanted directory.
user3878084
(11 rep)
May 1, 2025, 02:44 PM
• Last activity: May 1, 2025, 03:14 PM
8
votes
3
answers
26609
views
Ssh No route to host
I am trying to copy my Corosync key from my desktop to my laptop. sudo scp /etc/corosync/authkey mm-HP-Elit@192.168.0.10:~ What I got is this ssh: connect to host 192.168.0.10 port 22: No route to host lost connection Both of them use the same router in my house. From my desktop, I am pinging laptop...
I am trying to copy my Corosync key from my desktop to my laptop.
sudo scp /etc/corosync/authkey mm-HP-Elit@192.168.0.10:~
What I got is this
ssh: connect to host 192.168.0.10 port 22: No route to host
lost connection
Both of them use the same router in my house.
From my desktop, I am pinging laptop
ping 192.168.0.10
PING 192.168.0.10 (192.168.0.10) 56(84) bytes of data.
64 bytes from 192.168.0.10: icmp_seq=1 ttl=64 time=1.29 ms
64 bytes from 192.168.0.10: icmp_seq=2 ttl=64 time=1.08 ms
64 bytes from 192.168.0.10: icmp_seq=3 ttl=64 time=1.03 ms
64 bytes from 192.168.0.10: icmp_seq=4 ttl=64 time=1.05 ms
^C
--- 192.168.0.10 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 1.039/1.118/1.298/0.110 ms
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3004ms
Telenet is refused
telnet 192.168.0.10 22
Trying 192.168.0.10...
telnet: Unable to connect to remote host: Connection refused
My desktop IP
inet 192.168.0.12/24 brd 192.168.0.255 scope global dynamic noprefixroute enp3s0
My laptop IP
inet 192.168.0.10/24 brd 192.168.0.255 scope global dynamic noprefixroute wlo1
My idea was to open port 22.
Netstat output
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:902 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:38183 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:55181 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:38767 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:2224 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:8307 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:57721 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN 3340/dropbox
tcp 0 0 127.0.0.1:17600 0.0.0.0:* LISTEN 3340/dropbox
tcp 0 0 0.0.0.0:5473 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:17603 0.0.0.0:* LISTEN 3340/dropbox
tcp 0 0 0.0.0.0:37795 0.0.0.0:* LISTEN -
tcp6 0 0 :::902 :::* LISTEN -
tcp6 0 0 :::48647 :::* LISTEN -
tcp6 0 0 :::111 :::* LISTEN -
tcp6 0 0 :::2224 :::* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::39283 :::* LISTEN -
tcp6 0 0 :::51607 :::* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
tcp6 0 0 :::443 :::* LISTEN -
tcp6 0 0 :::35835 :::* LISTEN -
tcp6 0 0 :::17500 :::* LISTEN 3340/dropbox
tcp6 0 0 :::2049 :::* LISTEN -
I tried again to open 22
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
but still I do not see 22 with netstat
netstat -tpln | grep 22
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:2224 0.0.0.0:* LISTEN -
tcp6 0 0 :::2224 :::* LISTEN -
How to resolve this problem?
SOLVED
It was an sshd issue. I purged and installed OpenSSH server.
MikiBelavista
(1755 rep)
Jun 4, 2019, 06:43 AM
• Last activity: Apr 24, 2025, 12:42 AM
78
votes
6
answers
102233
views
Is there ever a reason to use scp instead of rsync?
Is there a reason to use `scp` instead of `rsync`? I can see no reason for using `scp` ever again, `rsync` does everything that `scp` does, with more safety (can preserve symlinks etc).
Is there a reason to use
scp
instead of rsync
? I can see no reason for using scp
ever again, rsync
does everything that scp
does, with more safety (can preserve symlinks etc).
mikebloch
(899 rep)
May 31, 2012, 07:02 AM
• Last activity: Apr 15, 2025, 04:51 PM
565
votes
6
answers
2655444
views
How to copy a file from a remote server to a local machine?
In my terminal shell, I ssh'ed into a remote server, and I `cd` to the directory I want. Now in this directory, there is a file called `table` that I want to copy to my local machine `/home/me/Desktop`. How can I do this? I tried `scp table /home/me/Desktop` but it gave an error about no such file o...
In my terminal shell, I ssh'ed into a remote server, and I
cd
to the directory I want.
Now in this directory, there is a file called table
that I want to copy to my local machine /home/me/Desktop
.
How can I do this?
I tried scp table /home/me/Desktop
but it gave an error about no such file or directory.
Does anyone know how to do this?
omega
(6147 rep)
Mar 5, 2015, 02:30 AM
• Last activity: Apr 2, 2025, 11:34 AM
0
votes
0
answers
511
views
Selecting protocol to transfer large (4GB) file through SSH port
My attempts to transfer a file to a remote Windows 7 computer have failed: - TeamViewer times-out - WinSCP times-out I am forced to re-start (vs. resuming) transferring the files. I have temporarily positioned the file on my Linux router and opened the SSH port for WinSCP. I can periodically access...
My attempts to transfer a file to a remote Windows 7 computer have failed:
- TeamViewer times-out
- WinSCP times-out
I am forced to re-start (vs. resuming) transferring the files. I have temporarily positioned the file on my Linux router and opened the SSH port for WinSCP. I can periodically access the remote (Windows 7) computer and WinSCP is available. It would be nice if WinSCP had rsync built-in.
Is there a robust (can resume session disconnects) file transfer protocol or app that will persistently reconnect until the transfer is completed (through SSH port 22)?
- Update: SFTP retrieved via ipkg to Linux router: SFTP tested and confirmed
- Update: Only the SCP connection over port 22 connected.
gatorback
(1522 rep)
Feb 4, 2018, 06:00 PM
• Last activity: Mar 30, 2025, 12:54 PM
2
votes
0
answers
118
views
SCP launches the SSH sub process with "-oPermitLocalCommand=no" - how to change this?
I have in my SSH ```~/.ssh/config``` the following configuration: ``` Host * # note: this needs in /etc/ssh/ssh_config: PermitLocalCommand yes # LocalCommand gpgconf --reload scdaemon ``` The reason for this is, the private RSA key for the SSH connection comes from an OpenPGP smartcard which is requ...
I have in my SSH
~/.ssh/config
the following configuration:
Host *
# note: this needs in /etc/ssh/ssh_config: PermitLocalCommand yes
#
LocalCommand gpgconf --reload scdaemon
The reason for this is, the private RSA key for the SSH connection comes from an OpenPGP smartcard which is requesting a PIN to give access and the card should be resetted with the above command after providing the key. This works fine for SSH, but not for SCP. SCP launches the required SSH command with an option "-oPermitLocalCommand=no"
which disables this feature.
One can see this nicely with:
strace -f -o scp.tr scp "-oPermitLocalCommand=yes" foo www.unixarea.de:.
...
grep execv scp.tr
10205 execve("/usr/bin/scp", ["scp", "-oPermitLocalCommand=yes", "foo",
"www.unixarea.de"...], 0xffffdf2147a0 /* 32 vars */) = 0
10206 execve("/usr/bin/ssh", ["/usr/bin/ssh", "-x", "-oPermitLocalCommand=no",
"-oClearAllForwardings=yes", "-oRemoteCommand=none", "-oRequestTTY=no", "-o",
"PermitLocalCommand=yes", "-oForwardAgent=no", "-l", "XXXXXXXXXXXXXXXX", "--",
"www.unixarea.de", "scp -t ."], 0xffffe38c6780 /* 32 vars */) = 0
and so the card remains active and provides keys without PIN entry.
This is on some Debian version of Linux, PureOS:
purism@pureos:~$ ssh -V
OpenSSH_8.4p1 Debian-5+deb11u3, OpenSSL 1.1.1w 11 Sep 2023
How could this be changed?
Matthias Apitz
(31 rep)
May 3, 2024, 09:31 AM
• Last activity: Mar 19, 2025, 04:28 PM
43
votes
4
answers
42318
views
How to pipe a remote file to stdout over scp or sftp?
Using ssh, it is easy to print the contents of a file using ssh host 'cat file.txt' When ssh is disabled, and only SFTP is enabled, running the previous command gives the following error: > This service allows sftp connections only. To work-around this issue, I could create a temporary file using `s...
Using ssh, it is easy to print the contents of a file using
ssh host 'cat file.txt'
When ssh is disabled, and only SFTP is enabled, running the previous command gives the following error:
> This service allows sftp connections only.
To work-around this issue, I could create a temporary file using
scp
or sshfs
(as shown below), but that looks really ugly. What is the proper way to print the contents of a remote file when SSH is disabled?
mkdir tmpdir
sshfs host: tmpdir
cat tmpdir/file.txt
fusermount -u tmpdir
# This does not work! scp -v host:file.txt . shows
# "Sink: This service allows sftp connections only."
scp host:file.txt .
cat file.txt
rm file.txt
Rob W
(998 rep)
Jul 28, 2014, 04:40 PM
• Last activity: Mar 7, 2025, 08:34 PM
-2
votes
1
answers
200
views
Authentication Failed using SCP to copy a file from Linux to Windows
I'm trying to use the SCP command to copy a file from Linux to Windows, the error I'm getting is practically identical to this question; https://stackoverflow.com/questions/61721025/pam-unix-sshd-authentication-failure-even-though-the-login-works. And this is the SCP command I'm using in Linux; `scp...
I'm trying to use the SCP command to copy a file from Linux to Windows, the error I'm getting is practically identical to this question; https://stackoverflow.com/questions/61721025/pam-unix-sshd-authentication-failure-even-though-the-login-works .
And this is the SCP command I'm using in Linux;
scp /volume1/homes/%userName%/imageConvert/x.png %username%@Ipv4Address:/C:/8/
to copy the x.png image to the folder C:\8 on Windows.
I've searched on identical issues that it can be a firewall blocking SSH/SCP I've checked Windows Defender Advanced Security if the remote host is being block and I see nothing showing a block ?
Christopher
(1 rep)
Feb 23, 2025, 03:11 PM
• Last activity: Feb 23, 2025, 10:15 PM
0
votes
1
answers
56
views
Host key verification failed ssh scp; no transfert
I know that is a popular subject but I can not find the right solution for my problem. On my pc I use scp and ssh with OpenWrt firmware, usually I use Debian or linux mint without any problem, but I did a fresh install and I got problem now with my firmware config back up. Here what I use since 2 ye...
I know that is a popular subject but I can not find the right solution for my problem.
On my pc I use scp and ssh with OpenWrt firmware, usually I use Debian or linux mint without any problem, but I did a fresh install and I got problem now with my firmware config back up.
Here what I use since 2 years without any problem.
# openwrt_backup
# Create tar_main
ssh root@192.168.1.1 sysupgrade -b /tmp/backup-main-$(date +%F).tar.gz
# Copy to local dir
scp -O root@192.168.1.1:/tmp/backup-*.tar.gz james@ninja:/run/media/james/E/openWrt_backup/
The problem is right now that after the second command, transfert the backup to my local pc, nothing happens:
james@ninja:~> scp -O root@192.168.1.1:/tmp/backup-*.tar.gz james@ninja:/run/media/james/E/openWrt_backup/
james@ninja:~> # empty answer??
Idea?
thanks
James78
(189 rep)
Feb 14, 2025, 04:10 PM
• Last activity: Feb 14, 2025, 04:44 PM
6
votes
1
answers
4721
views
scp: using specific NIC
I am trying to achieve to perform scp via specific NIC. I read [`scp` man page](https://man.openbsd.org/scp) but couldn't find required flags.
I am trying to achieve to perform scp via specific NIC.
I read [
scp
man page](https://man.openbsd.org/scp) but couldn't find required flags.
Raja G
(6177 rep)
Sep 3, 2019, 05:29 AM
• Last activity: Jan 31, 2025, 06:51 PM
21
votes
2
answers
42474
views
How to view progress with sshpass and scp in linux?
In my Linux terminal, I am using this command sshpass -p "pass" scp -r me8@host.ca:/cmshome/me/file /home/me/Desktop to download a file with a password in it. Without the sshpass, I can see the download progress, but with it, it is just blank until it finishes and I can't see it. Is there a way I ca...
In my Linux terminal, I am using this command
sshpass -p "pass" scp -r me8@host.ca:/cmshome/me/file /home/me/Desktop
to download a file with a password in it. Without the sshpass, I can see the download progress, but with it, it is just blank until it finishes and I can't see it.
Is there a way I can see it with sshpass?
omega
(6147 rep)
Mar 5, 2015, 03:17 AM
• Last activity: Jan 25, 2025, 07:52 AM
63
votes
6
answers
62069
views
SCP fails without error
I've been experiencing very strange behavior of SCP for some time: whenever I try to copy a file, the output of SCP contains a bunch of underscores and the file is not copied. $ scp test.txt 192.168.0.2:~ job@192.168.0.2's password: ________________________________________ When I create an SSH conne...
I've been experiencing very strange behavior of SCP for some time: whenever I try to copy a file, the output of SCP contains a bunch of underscores and the file is not copied.
$ scp test.txt 192.168.0.2:~
job@192.168.0.2's password:
________________________________________
When I create an SSH connection using Midnight Commander and copy files it does work.
Some info about my machine:
$ ssh -V
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
$ uname -a
Linux squatpc 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:05:41 UTC 2011 i686 i686 i386 GNU/Linux
And I'm running Kubuntu 11.04.
**Edit:** Some more info as requested by the comments:
$ scp -v test.txt 192.168.0.2:~
Executing: program /usr/bin/ssh host 192.168.0.2, user (unspecified), command scp -v -t -- ~
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.0.2 [192.168.0.2] port 22.
debug1: Connection established.
debug1: identity file /home/job/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/job/.ssh/id_rsa-cert type -1
debug1: identity file /home/job/.ssh/id_dsa type -1
debug1: identity file /home/job/.ssh/id_dsa-cert type -1
debug1: identity file /home/job/.ssh/id_ecdsa type -1
debug1: identity file /home/job/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1 Debian-1ubuntu3
debug1: match: OpenSSH_5.8p1 Debian-1ubuntu3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8p1 Debian-1ubuntu3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 28:f3:2b:31:36:43:9b:07:d8:33:ca:43:4f:ca:6c:4c
debug1: Host '192.168.0.2' is known and matches the ECDSA host key.
debug1: Found key in /home/job/.ssh/known_hosts:20
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/job/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/job/.ssh/id_dsa
debug1: Trying private key: /home/job/.ssh/id_ecdsa
debug1: Next authentication method: password
job@192.168.0.2's password:
debug1: Authentication succeeded (password).
Authenticated to 192.168.0.2 ([192.168.0.2]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -t -- ~
________________________________________
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 2120, received 1872 bytes, in 0.3 seconds
Bytes per second: sent 7783.1, received 6872.6
debug1: Exit status 0
and
$ type scp
scp is hashed (/usr/bin/scp)
mtvec
(2796 rep)
Aug 7, 2011, 12:19 PM
• Last activity: Jan 24, 2025, 04:52 PM
0
votes
1
answers
41
views
crontab to make distant backup
I'm trying to backup my project, databases & nginx environnement. For that, I'm doing backup from my main server and place it in /home/backup/. Everything work on the main server. Then, from my second server, I'm creating a cron to get that files through SCP. Here is my command : 0 13 * * * sudo ssh...
I'm trying to backup my project, databases & nginx environnement. For that, I'm doing backup from my main server and place it in /home/backup/. Everything work on the main server.
Then, from my second server, I'm creating a cron to get that files through SCP.
Here is my command :
0 13 * * * sudo sshpass -p MyPassword sudo scp -P 40511 -r user@mydomain.com:/home/backup /home
I'm using port 40511 as SSH.
The command works if launched manually, but doesn't work with cron.
MyPassword contain an "!". I tried with and without double-quote.
What am I doing wrong ?
P. Jerome
(123 rep)
Jan 20, 2025, 11:29 AM
• Last activity: Jan 20, 2025, 03:47 PM
0
votes
1
answers
57
views
backup to router and scp to local pc
I want to make my openwrt backup with command from my local terminal, pretty easy, but my problem is after that, it is when I try to bring back the backup to my local pc. Here what I have for now, first part is ok: ``` #!/bin/bash ssh root@192.168.1.1 sysupgrade --create-backup /tmp/main_backup.tar....
I want to make my openwrt backup with command from my local terminal, pretty easy, but my problem is after that, it is when I try to bring back the backup to my local pc. Here what I have for now, first part is ok:
#!/bin/bash
ssh root@192.168.1.1 sysupgrade --create-backup /tmp/main_backup.tar.gz
with that command I create my router's backup and I want to scp that backup to my local pc.
James78
(189 rep)
Dec 12, 2024, 12:51 PM
• Last activity: Dec 12, 2024, 01:33 PM
1
votes
2
answers
695
views
Is my "escaping" wrong - or is it something else?
Here's what I'm trying to do (in a script): ```bash #!/usr/bin/env bash if [[ ! $("/usr/bin/scp seamus@fumier.local:/Users/seamus/Downloads/imgutils/image-utils* /home/pi/testscp") ]]; then printf "\nERROR & EXIT: 'scp' failed \n" exit 1 fi printf "success!\n" ``` I've tried doing this in a few ways...
Here's what I'm trying to do (in a script):
#!/usr/bin/env bash
if [[ ! $("/usr/bin/scp seamus@fumier.local:/Users/seamus/Downloads/imgutils/image-utils* /home/pi/testscp") ]]; then
printf "\nERROR & EXIT: 'scp' failed \n"
exit 1
fi
printf "success!\n"
I've tried doing this in a few ways, but nothing seems to work. Here's what I get from the above:
./testscp.sh: line 3: /usr/bin/scp seamus@fumier.local:/Users/seamus/Downloads/imgutils/image-utils* /home/pi/testscp: No such file or directory
ERROR & EXIT: 'scp' failed
The scp
command runs OK when it's on a line by itself. If I do that, I can test for $0
- which works OK... but I'd prefer to do it all in a single line. What am I missing?
Seamus
(3772 rep)
Nov 26, 2024, 09:20 AM
• Last activity: Nov 26, 2024, 05:13 PM
124
votes
8
answers
298036
views
Why is scp so slow and how to make it faster?
I'm trying to copy a batch of files with `scp` but it is very slow. This is an example with 10 files: $ time scp cap_* user@host:~/dir cap_20151023T113018_704979707.png 100% 413KB 413.2KB/s 00:00 cap_20151023T113019_999990226.png 100% 413KB 412.6KB/s 00:00 cap_20151023T113020_649251955.png 100% 417K...
I'm trying to copy a batch of files with
scp
but it is very slow. This is an example with 10 files:
$ time scp cap_* user@host:~/dir
cap_20151023T113018_704979707.png 100% 413KB 413.2KB/s 00:00
cap_20151023T113019_999990226.png 100% 413KB 412.6KB/s 00:00
cap_20151023T113020_649251955.png 100% 417KB 416.8KB/s 00:00
cap_20151023T113021_284028464.png 100% 417KB 416.8KB/s 00:00
cap_20151023T113021_927950468.png 100% 413KB 413.0KB/s 00:00
cap_20151023T113022_567641507.png 100% 413KB 413.1KB/s 00:00
cap_20151023T113023_203534753.png 100% 414KB 413.5KB/s 00:00
cap_20151023T113023_855350640.png 100% 412KB 411.7KB/s 00:00
cap_20151023T113024_496387641.png 100% 412KB 412.3KB/s 00:00
cap_20151023T113025_138012848.png 100% 414KB 413.8KB/s 00:00
cap_20151023T113025_778042791.png 100% 413KB 413.4KB/s 00:00
real 0m43.932s
user 0m0.074s
sys 0m0.030s
The strange thing is that the transfer rate is about 413KB/s and the file size is about 413KB so really it should transfer one file per second, however it's taking about 4.3 seconds per file.
Any idea where this overhead comes from, and is there any way to make it faster?
laurent
(2068 rep)
Oct 23, 2015, 01:34 PM
• Last activity: Nov 26, 2024, 02:59 PM
Showing page 1 of 20 total questions