Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I massively use scp and ssh for work. I'm a little bored to insert the password everytime Usually I scp many files from term and I was wondering if there is a way to mantain open the scp connection. I mean, it would be great if there is something like this:

$ scp user@server # to estabilsh the connection
user@server's password:
$ scp file1 user@server:/folder # No password asked!
$ scp close # to close the connection
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

While it may be possible to keep the connection open, the best way of doing this is probably to use public key authentication, which avoids the need to repeatedly type a password.

Assuming both the local and remote machines are running linux:

user@local $ cat .ssh/id_rsa.pub | ssh user@remote 'cat >> .ssh/authorized_keys'

Will add the SSH key of the local machine to the list of pre-approved users of the remote machine, and subsequent ssh or scp commands should not require a password.

If you still get asked for a password, you might need to do

user@remote $ chmod 400 .ssh/authorized_keys
share|improve this answer
    
Hi! Thank you for the answer. I'm going to try it on monday when I'll be back to work! –  the_candyman Dec 1 '12 at 15:38
add comment

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.