Solved

Please explain this scp command

Posted on 2009-05-05
6
296 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
  • 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

914 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now