0

Using ssh file, able to copy a file from one linux machine to another linux machine by entering a password. If i want to copy 10 files, it is asking me to enter password for each file (10 times), are there any options to copy all files by entering the password only once?

Sample command which i'm using:

spawn scp /modules/com/sample.jar username@machinename:/modules/com/sample.jar
  • 2
    What's wrong with: scp file1 file2 file3 file4 file5 file6 file7 file8 file9 file10 username@computername:/path/to/directory – garethTheRed Oct 23 '15 at 19:53
  • There is no way to "store" the password or the first authentication to use from one command to the next, but you can use ssh keys like Thorian suggests. If you're using spawn with expect, then the ssh key solution is the only safe way. – simpleuser Oct 23 '15 at 20:07
  • 1
    Why not create an archive and send the archive ( jar, tar.{gz,bz2,xz}, zip) to the other machine? – fd0 Oct 23 '15 at 20:12
  • What @garethTheRed suggested is what I'd do. – Housni Oct 23 '15 at 21:01
2

If you access the remote host on a regular basis set up a ssh key. You can find the documentation here: http://www.cyberciti.biz/faq/how-to-set-up-ssh-keys-on-linux-unix/

Also there is a tutorial with rsync on superuser: https://superuser.com/questions/555799/how-to-setup-rsync-without-password-with-ssh-on-unix-linux

0

Swap ssh keys, or you can use filezilla if you boot to UI

Also, if you don't want to swap ssh keys, you can put all those files in a folder and then just use * to move them all at one

spawn scp /modules/com/*.jar username@machinename:/modules/com/

http://www.cyberciti.biz/faq/how-to-set-up-ssh-keys-on-linux-unix/

https://filezilla-project.org/download.php

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.