Using SCP for Secure File Transfer
SCP (Secure Copy) is a command-line utility designed for quick and secure file transfers between hosts. By relying on SSH, SCP guarantees that your data is encrypted throughout the transfer process. Below is the basic syntax and usage examples.Basic SCP Syntax
- Specify the username and remote host using the format:
username@remote_host - Provide the remote file path prefixed with a colon and a slash (
:/). - Define the local destination path where the file will be saved.
192.168.1.27 using the username aaron, execute:
When using SCP without explicitly specifying a username, the current local user will be assumed for the remote host.
Using SFTP for Interactive File Transfers
SFTP (Secure File Transfer Protocol) offers a more user-friendly, interactive interface for managing and transferring files securely. The connection command resembles that of SCP, providing an easy transition if you’re familiar with secure shell protocols.Establishing an SFTP Connection
To connect to a remote host using the SFTP protocol, run:sftp> prompt. From here, you can execute a range of commands to navigate and manage files.
Common SFTP Commands
- ls – Lists files and directories on the remote system.
- cd – Changes directories on the remote host.
- lls or lcd – Lists files or changes directories locally (note the
lprefix).
Pictures directory on the remote host, type:
get command:
-r flag:
put command:
Always ensure that you have the necessary permissions on both the local and remote systems to transfer files securely.