Showing posts with label scp. Show all posts
Showing posts with label scp. Show all posts

Secure copying via SCP

SCP allows to securely transfer files between a local host and a remote host or between two remote hosts. It is based on the SSH protocol.

Copying file to host:
scp file user@host:directory/

Copying file from host to current directory:
scp user@host:directory/file .

To copy entire folders use -r parameter:
scp -r user@host:directory/folder .

SCP by default uses port 22. Sometimes remote host may have it blocked or just uses other port. You can specify the different port using -P parameter.

To copy all files from remote host using port 23: 
scp -P 23 user@host:/directory/* .

To copy all files from current directory to remote host using port 23:
scp -P 23 * user@host:/directory