Solved

Please explain this scp command

Posted on 2009-05-05
6
300 Views
Last Modified: 2012-06-27
Can anybody please decode this for me
scp -r -i /user/home/xceldt/.ssh/id_fdt-test kstsrv5:/user/home/data/arc*$archivedate*/*.tar.gz temp
0
Comment
Question by:Umavmishra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24303344
Hi,
-r tells scp to recursively copy entire directories.
-i tells scp which identity file (the file from which the identity (private key) for RSA authentication is read) to use.
kstsrv is the remote host
:  is the deimiter between hostname and the following -  
/user/home/data/arc*$archivedate*/*.tar.gz  ist the directory to copy from the remote host. There is a variable $archivedate contained in a directory name. This variable is set outside of scp, probably ba the script which contains the scp command.
temp is the local destination directory
wmp
 
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24303427
... let's assume $archivedate contains "2009-05-05"
scp will copy from kstsrv all files which match "*.tar.gz" from the directory or directories  matching "/usr/home/data/arc*2009-05-05*/"
The asterisks surrounding $archivedate and the asterisks contained in the filename make scp copy e.g.
/usr/home/arcABC2009-05-05DEF/UVW.tar.gz   or
 /usr/home/arcGHI2009-05-05JKL/XYZ.tar.gz  
 Replace the bold strings above with any actually existing directory/file on that host.
0
 

Author Comment

by:Umavmishra
ID: 24324118
Thanks woolmilkporc
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:Umavmishra
ID: 24324127
can you please tell me how do i give the acess details in the identity file?
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 24324329
scp is based on ssh,  and one of ssh's authentication methods is 'publickey'.  This method is the one which deals with the identity file.
This method implies generating a public/private key pair.
To do so, you must run 'ssh-keygen'. During ssh-keygen you are asked for a passphrase. Leave this empty (just hit <enter>) to be able to log in with ssh (or initiate scp) without to have to enter this passphrase every time.  
The 'public' part is then given to the remote location and added there to a file named 'authorized_keys' somewhere in the home directory of the remote user (mostly ~/.ssh/authorized_keys)
The 'private' part is placed in a file at the local server, mostly in the home directory of the local user (~/.ssh/id_rsa). If this file is placed elsewhere and/or named differently, you need the -i flag of scp  to point to this 'identity file'.
HTH
wmp
 
 
 
0
 

Author Closing Comment

by:Umavmishra
ID: 31577955
Thanks a lot!
0

Featured Post

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question