Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 /some/local/path

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

share|improve this answer

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

Your Answer


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.