Solved

Please explain this scp command

Posted on 2009-05-05
6
299 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.

759 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