scp between two different hosts
Every now and then I try to scp files between two hosts with just one command. But it mysteriously fails with:
$ scp bob@saturn:/tmp/foo alice@pluto:/tmp/bar bob@saturn's password: Permission denied, please try again.But the password for
bob@saturn is definitely right (I promise!), so what's going on here? Let's take a closer look:
$ scp bob@saturn:/tmp/foo alice@pluto:/tmp/bar
bob@saturn's password:
^Z
$ ps -ef | grep [s]cp
[...] scp bob@saturn:/tmp/foo alice@pluto:/tmp/bar
[...] /usr/bin/ssh -x -oClearAllForwardings yes -n -l bob saturn \
scp /tmp/foo alice@pluto:/tmp/bar
Now we see that scp(1) was actually executed on the saturn. The Permission denied was already pluto's response to the connection attempt. After stumbling over this issue a few times I finally found a nice explanation describing all this.