SCP (Secure Copy) is a command line tool for Linux systems for securely transferring files from a remote server to the local system or vice versa. SCP uses SSH protocol for transferring files between two systems which is more secure than FTP.
SCP command required the password of the remote system. In case you need to configure scp command in script and run with scheduler, you need to configure key based ssh login.
- Use the following command to copy the folder from remote to local recursively
scp -r [email protected]:/path/to/folder /path/to/local
- In case, SSH is running on a different port, use -P to define port number with the SCP command:
scp -P 2222 -r [email protected]:/path/to/folder /path/to/local
- If the authentication is configured with a pem file. you can use the pem as below:
scp -i auth.pem -r [email protected]:/path/to/folder /path/to/local