LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-30-2012, 12:58 AM   #1
rpd25
LQ Newbie
 
Registered: Dec 2011
Posts: 12

Rep: Reputation: Disabled
scp - multiple files at once


Hi,

I used the scp command to transfer files in different clusters.

scp -rp username@remotehost.edu:/DirectoryLocation/udisp.{0,{100..10000..100}}.* .

The files are transferred, however after every 100'th iteration, it asks me the password to transfer files.
This is very irritating. Is there any option to grant transfer permission once?

One more thing, how to transfer multiple files
udisp.{0,{100..10000..100}}.* and vdisp.{0,{100..10000..100}}.*
(in interval of 100's) at once using scp?

Thanks,
Rakesh
 
Old 01-30-2012, 01:23 AM   #2
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
You can use public key to avoid having to introduce the password.
 
Old 01-30-2012, 01:32 AM   #3
eehmke
LQ Newbie
 
Registered: Aug 2011
Distribution: Debian, Gentoo
Posts: 24

Rep: Reputation: 0
Quote:
Originally Posted by rpd25 View Post
Hi,

I used the scp command to transfer files in different clusters.

scp -rp username@remotehost.edu:/DirectoryLocation/udisp.{0,{100..10000..100}}.* .

The files are transferred, however after every 100'th iteration, it asks me the password to transfer files.
This is very irritating. Is there any option to grant transfer permission once?
You can transfer your public ssh key to the target system (even using scp) and add it the authorized_keys file. The key is here:
Code:
~/.ssh/id_rsa.pub
If this does not exist, create it:
Code:
ssh-keygen
On the target system, add it like this:
Code:
cat id_rsa.pub >> ~/.ssh/authorized_keys
You will never been asked for a password again.
 
Old 01-30-2012, 01:47 AM   #4
Jebram
LQ Newbie
 
Registered: May 2007
Location: Berlin, FRG
Distribution: Ubuntu
Posts: 22

Rep: Reputation: 4
To really avoid being asked for a password, use public key
authentication together with ssh-agent and the Batch option of "scp":
ssh-keygen -2 -b 2048
ssh-agent >$HOME/.ssh/ssh-agent-env.sh; source $HOME/.ssh/ssh-agent-env.sh; ssh-add
scp -rpB username@remotehost.edu:udisp*

You did not say what kind of shell you are using. bash supports brace expansion,
but not with step arguments.
 
  


Reply

Tags
multiple, scp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple scp/ssh in one bash script Lovelyhard Programming 13 07-31-2012 09:37 AM
scp file to multiple hosts with expect loadedmind Programming 4 04-11-2011 09:28 PM
[SOLVED] Bash backup script with scp, multiple processes mky Programming 8 09-29-2010 06:28 PM
scp for multiple cilents?? mlu Linux - Networking 1 05-25-2005 09:44 AM
Spawning multiple scp using different I/F sam0murphy Solaris / OpenSolaris 1 05-18-2005 08:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration