Solved

Please explain this scp command

Posted on 2009-05-05
6
295 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
Comment Utility
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
Comment Utility
... 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
Comment Utility
Thanks woolmilkporc
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:Umavmishra
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks a lot!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 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

6 Experts available now in Live!

Get 1:1 Help Now