SCP – ‘Permission Denied, Try Again’ While Transferring Files

file-copyremotescpssh

I have two servers (A and B) and my local machine. I'm trying to transfer a file from server A to server B.

From server A:

scp ./backup.tar user@server.b:/home/public/
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey, password).
lost connection

From server B:

scp user@server.a:/home/public/backup.tar .
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey, password).
lost connection

Same error message when I try from my local computer. What's going on?


This is what I get when I try to ssh from Server A to Server B with the debug flag:

debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/private/.ssh/identity
debug1: Trying private key: /home/private/.ssh/id_rsa
debug1: Trying private key: /home/private/.ssh/id_dsa
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such file or directory
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such file or directory
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
Permission denied (publickey,password).

Does this mean it can't find my terminal? I should mention that server B is a subdomain of server A. My hosting provider however sees them as completely different entities and they are not hosted on the same LPAR.


Conclusion
I've emailed my hosting provider and it seems that there is a small bug related to the version of ssh and the OS (freeBSD). Currently, my workaround is to (1) scp the file locally to my machine, then (2) scp the file locally to the second server. This is what scp -3 is supposed to do, but that fails as well.

Best Answer

This looks like there is a problem with ssh configuration on the servers - you cannot ssh from any of them (probably for security reasons).

You can try Stephane's suggestion to do the transfer from your local machine (scp user@server.a:/home/public/backup.tar user@server.b:/home/public/). This should out rule the problem with taking input from terminal (which might me purposely created on the servers).

If that doesn't help, it will mean that the provider probably disallows outgoing ssh connections. In that case, you'll be left with two options:

  • ask the provider to enable outgoing ssh connections

or

  • transfer the files through your local machine:

    scp -3 user@server.a:/home/public/backup.tar user@server.b:/home/public/

Related Question