0

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 root@xxx.xxx.xxx.xxx:/var/spool/servera/backup/2018Backups /home/serverb/Documents/2018Backups
  • Can you show a sample ssh command that works for you? – Mark Plotnick Nov 16 '18 at 15:13
  • ssh root@xxx.xxx.xxx.xxx – Brian Nov 16 '18 at 15:20
5

When you run

ssh root@xxx.xxx.xxx.xxx

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

When you run

sudo scp -r root@xxx.xxx.xxx.xxx ...

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.

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.