Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On debian, is there anyway for scp to remember the password I've typed in for the duration of my ssh logon, similar to how sudo does?

i.e. PC ---ssh(putty)---> server 1 ---scp---> server 2

I don't want to setup public/private keys because I don't have control of all the remote servers. I just don't want to have to type my password in for every single file I'm copying.

Is this possible in anyway?!

share|improve this question

2 Answers 2

Only if you set up a key. You can then use ssh-add to add the private key to your local SSH agent which will then provide the key to the SSH client when asked. You will only need to enter the passphrase during the initial add.

share|improve this answer

Use sshpass: ssh uses direct TTY access to make sure that the password is indeed issued by an interactive keyboard user. sshpass runs ssh in a dedicated tty, fooling it into thinking it is getting the password from an interactive user.

sshpass -p 'password' scp -r user@example.com:/some/remote/path /some/local/path

You can also use sshpass with ssh, rsync and scp.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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