scp- secure way to copy files over ssh
The SCP protocol, which runs on port 22, is similar to the BSD
rcp protocol, however unlike rcp, data is encrypted during transfer,
to avoid potential packet sniffers extracting usable information
from the data packets. The protocol itself does not provide authentication
and security; it relies on the underlying protocol, SSH, to provide these features.
You can use scp to copy files between remote hosts using secure a connexion.
Just like the cp command, scp will overwrite an existing destination file. In addition, if the destination is an existing directory, the copied material will be placed beneath the directory.
How to use scp
The general form of the command is:
scp source-specification destination-specification
where source-specification indicates which file or directory is to be copied, and destination-specification
indicates where the copied material is to be placed.
1 – Copy files to a remote host X and from the remote host X to my computer (Host Y) :
For example , I want to copy the file sim.log from my computer (Host Y) to the folder /tmp on
the remote host X
Copy file to a remote host :
zinovsky@unixmenhowtos:~$ scp /home/zinovsky/sim.log root@remotehost-X:/tmp
sim.log 100% 873 0.9KB/s 00:00
Copy a file from a remote host X to host Y (my computer) :
Now I will copy the file sim.log from the remote host X to the desktop of my computer :
zinovsky@unixmenhowtos:~$ scp root@remotehost-X:/tmp/sim.log /home/zinovsky/Desktop
sim.log 100% 873 0.9KB/s 00:00
2- Copy a folder to a remote host or between 2 remote hosts :
Example : I want to copy a folder called -salamon – from my desktop to the folder /tmp on the remote host X :
scp -r /home/zinovsky/Desktop/salamon email@example.com:/tmp
To copy a folder called unixmen from the remote host X to to the desktop of my computer where i`m connected :
scp -r firstname.lastname@example.org:/tmp/unixmen /home/zinovsky/Desktop/
Now you can use the same described above to copy files and folders between 2 remote hosts.
So while you are connected to remote host X you can copy files and folders to remote host Y.
Here are some Options :
Specifies the port to connect to on the remote host. Note that
this option is written with a capital ‘P’, because -p is already
reserved for preserving the times and modes of the file in
-p Preserves modification times, access times, and modes from the
-q Quiet mode:
disables the progress meter as well as warning and
diagnostic messages from ssh(1).
-r Recursively copy entire directories. Note that scp follows sym‐
bolic links encountered in the tree traversal.
Name of program to use for the encrypted connection. The program
must understand ssh(1) options.
-v Verbose mode.
Causes scp and ssh(1) to print debugging messages
about their progress. This is helpful in debugging connection,
authentication, and configuration problems.
The scp utility exits 0 on success, and >0 if an error occurs.
You can lean more about scp and scp commands by typing this command on the terminal :
If you need any help, the doors of our forum is always open.
Like us on Facebook
We need your assistance to stay live
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Fedora 21 Scheduled For Release In October : For Fedora users, just keep calm and use Fedora 20 for now. Fedora Developers has announced that F...1 comment |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- Install LAMP Server (Apache, MySQL or MariaDB, PHP) On Ubuntu 13.10 : Updated January 12, 2014 LAMP is a combination of operating system and open-source software stack. ...0 comments |
- Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comments |
- How to Install uTorrent Client on Ubuntu/Debian/Linux Mint : uTorrent is a lightweight and efficient BitTorrent client for Linux, Windows OS and Mac OS. The inst...0 comments |
- Fedora 21 Scheduled For Release In October
- Install Uget Download Manager In Ubuntu, Fedora, Debian
- Download Elementary OS ‘Luna’ Official Wallpapers
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04
- 5 Android Apps that’s Going to Make Running Your Business Less Stressful
- Puppet agent Install Using Script
- Install Corosync and Pacemaker On CentOS 6.5
- Install Fail2Ban On Ubuntu Server 13.04/13.10
- How To Install Google Chrome in Fedora 20, 19, 18
- How to surf using Tor Browser Bundle
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .