So I setup ssh keys, tested it via cli and all works great. When I go to run a SCP file transfer it asks for my password for both machines, yet if I simply ssh to the same server it does not.

Below is the scp that I am running. If I enter the passwords when prompted the file transfer goes through, I am simply trying to avoid having to enter the password each time.

sudo scp -r [email protected]:/var/spool/servera/backup/2018Backups /home/serverb/Documents/2018Backups

1 Answer 1


When you run

ssh [email protected]

You are doing it as yourself (e.g. Brian)

When you run

sudo scp -r [email protected] ...

you are really running as root. Hence, you are using different private/public key pairs.

Try the scp without the sudo to some directory that you, Brian, not root, has access to and see what happens.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .