2

Background

I want to copy files from a remote machine remoteA to another remoteB. These machines require password authentication.

Steps I tried

I tried this command

$ scp -3 user@remoteA:/path/to/file user@remoteB:/path/to/dest

then double password prompt appeared in a line.

Password: Password:

then I entered passwords as follows,

Password:
Password:
Password:
Password:
user@remoteB: Permission denied (publickey,keyboard-interactive).
user@remoteA: Permission denied (publickey,keyboard-interactive).

but permission denied.

Is there any way to scp between these machines?


Environment

local machine

  • macOS Mojave 10.14.4
  • ssh -V: OpenSSH_7.9p1, LibreSSL 2.7.3

Modified #1

I already have .ssh/config files as follows

Host remoteA
  HostKeyAlias remoteA
  ControlMaster auto
  ControlPath ~/.ssh/mux-%r@%h:%p
Host remoteB
  HostKeyAlias remoteB
  ControlMaster auto
  ControlPath ~/.ssh/mux-%r@%h:%p
4
  • Generate ssh key pair(s) and properly install them on remoteA, remoteB (public key) and the local machine (private key(s)). Then you don't need to enter passwords. If you can't do that, experiment with ssh-askpass and/or ssh-agent, so you can enter the passwords beforehand. – dirkt May 8 '19 at 7:03
  • 1
    I had no previlege to change remote machines so I set ssh-askpass then made it. Thanks, @dirkt ! – kkk May 8 '19 at 7:44
  • For the next person with the same problem, please write an answer providing details of what you did do. You can accept your own answer. (Also, if you can copy files to the remote machines, you can probably make a file .ssh/authorized_keys, either with ssh or scp, and this is all you need to set up keys on the remote machines, unless you have a non-default configuration on them). – dirkt May 8 '19 at 7:47
  • ssh-askpass not work properly again. superuser.com/questions/1434275/… – kkk May 8 '19 at 9:27
2

ControlMaster settings (as above Modified #1 Section) skip asking password.

First, connect each server using ssh command.

(ttys001)
$ ssh remoteA
---
(ttys002)
$ ssh remoteB

Then, do scp in another tty.

(ttys003)
$ scp -3 user@remoteA:/path/to/file user@remoteB:/path/to/dest

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.