Difference between revisions of "Linux and UNIX Secure Copy"
Line 2: | Line 2: | ||
The command scp is used to copy files across ssh connection. You can use scp to copy files from or to a remote host. Using ssh for data transfer provides the same authentication and same level of security as ssh. | The command scp is used to copy files across ssh connection. You can use scp to copy files from or to a remote host. Using ssh for data transfer provides the same authentication and same level of security as ssh. | ||
+ | |||
+ | == usage examples == | ||
Examples: | Examples: | ||
Line 28: | Line 30: | ||
scp nicolep@serverone.com:/usr/local/download/foobar.txt nicolep@servertwo.com:/home/nicolep | scp nicolep@serverone.com:/usr/local/download/foobar.txt nicolep@servertwo.com:/home/nicolep | ||
+ | |||
+ | == installation == | ||
+ | |||
+ | Red Hat Enterprise Linux, CentOS, Trustix | ||
+ | |||
+ | yum install openssh-clients | ||
+ | |||
+ | Debian or Ubuntu | ||
+ | |||
+ | apt-get install openssh-client | ||
[[Category:Computer_Technology]] | [[Category:Computer_Technology]] | ||
[[Category:Linux]] | [[Category:Linux]] |
Revision as of 16:36, 25 January 2016
This article is about the scp command.
The command scp is used to copy files across ssh connection. You can use scp to copy files from or to a remote host. Using ssh for data transfer provides the same authentication and same level of security as ssh.
usage examples
Examples:
Copy the file "foobar.txt" from a remote host to the local host
scp nicolep@remotehost.com:foobar.txt /usr/local/download
Copy the file "foobar.txt" from the local host to a remote host
scp foobar.txt nicolep@remotehost.com:/usr/local/download
More examples:
Recursively copy entire directories. This will get all the web directories and sub-directories and copy to the local machine
scp -r bob@10.0.0.1:/home/httpd/html/* /home/httpd/html
The -r is the flag for recursive
Now to copy all files in the current working directory to a remote server web directory
scp * nicolep@10.0.0.9:/var/www/html
Copy a file from one remote host to another, neither file residing nor resulting on the current machine.
scp nicolep@serverone.com:/usr/local/download/foobar.txt nicolep@servertwo.com:/home/nicolep
installation
Red Hat Enterprise Linux, CentOS, Trustix
yum install openssh-clients
Debian or Ubuntu
apt-get install openssh-client