Learn how to use the default SFTP client in Linux and Unix operating systems
OpenSSH, which is a suite of secure networking utilities based on the SSH (Secure Shell) protocol, includes a command-line utility for interacting with SSH servers for file transfer purposes. This utility is simply called sftp.
Here's a brief overview of how to use the sftp command:
Connecting to a Server:
To connect to an SSH server using SFTP, you would typically use the following command:
Replace username with your username on the server and hostname with the hostname or IP address of the server.
The sftp command-line utility provides a straightforward way to perform secure file transfers over SSH connections without needing a separate FTP client. It's often used in scripting and automation tasks where manual interaction isn't required.
Couchdrop supports the default sftp command natively. Simply switch out the hostname and credentials from the example above.
Authenticating:
After executing the command, you will be prompted to enter your password for the specified username.
Navigating Directories:
Once connected, you'll be in the SFTP interactive shell, similar to a command-line interface.
You can use commands like ls, cd, and pwd to navigate directories on the server.
Transferring Files:
To upload a file from your local machine to the server, you can use the put command:
To download a file from the server to your local machine, you can use the get command:
Exiting SFTP:
To exit the SFTP session, you can use the exit command:
Or simply type exit and press Enter.
put localfile.txtget remotefile.txtexitsftp username@hostnamesftp [email protected]