0% found this document useful (0 votes)
13 views

SCP Eng

The scp command allows users to securely copy files and directories between servers or from a server to a local system using SSH. It uses the same syntax as the ssh command, with the addition of specifying the source and destination files/directories. Examples show how to copy a single file, directory with subdirectories, or from a remote server to the local system using both absolute and relative paths.

Uploaded by

yrual
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

SCP Eng

The scp command allows users to securely copy files and directories between servers or from a server to a local system using SSH. It uses the same syntax as the ssh command, with the addition of specifying the source and destination files/directories. Examples show how to copy a single file, directory with subdirectories, or from a remote server to the local system using both absolute and relative paths.

Uploaded by

yrual
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SSH: to copy a file with the scp command [Cacher sommaire] 1. Definition 2. Usage 3. Syntaxe 4.

Examples

1. Definition
The scp command allows you to copy a file or a directory (-r) from the client to a server or from a server to the client. The path of the server could be given in absolute (/home/dupont/Directory for example) or relatively from the base directory Directory. To use scp, you should know the correct paths of the directories on the remote server. Also, SSH should be installed on the two servers which should communicate to make your transfert. BE CAREFULL: at Computing Center, you should give your password. It is not possible to make an authentification using SSH keys exchange (see To connect at Computing Center using SSH).

2. Usage
scp [-pqrvBC1246] [-F ssh_config] [-S program] [-P port] [-c cipher] [-i identity_file] [-l limit] [-o ssh_option] [[user@]host1:]file1 [...] [[user@]host2:]file2

3. Syntaxe

To copy a file from a server called server1 to an other one called server2:
> scp Login1@Server1:Path1/File1 Login2@Server2:Path2/File2

To copy a local file from the current directory to a directory on the remote server:
> scp File Login@Server:Path/

To copy a local directory, with sub-directories if any, to a directory on the remote server:
> scp -r Directory Login@Server:Path/

To copy a file from the remote server to the current local directory:
> scp Login@Server:Path/File .

To copy a directory from the remote serveur to the current local directory:
> scp -r Login@Server:Path/Directory .

4. Examples
> scp [email protected]:/afs/in2p3.fr/home/c/calvat/Readme.txt .

copy the file Readme.txt from /afs/in2p3.fr/home/c/calvat on ccali.in2p3.fr to the current local directory.
> scp -r [email protected]:/afs/in2p3.fr/home/c/calvat/toto .

copy the directory toto and the attached sub-directories from /afs/in2p3.fr/home/c/calvat on ccali.in2p3.fr to the current local directory.

You might also like