Linux and UNIX Secure Copy: Difference between revisions

From Free Knowledge Base- The DUCK Project
Jump to navigation Jump to search
Created page with "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 d..."
 
No edit summary
Line 23: Line 23:
Now to copy all files in the current working directory to a remote server web directory
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
  scp * nicolep@10.0.0.9:/var/www/html
[[Category:Computer_Technology]]
[[Category:Linux]]

Revision as of 15:30, 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.

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