sftp,

How to connect with SFTP through the command line

Jan 11, 2022 · 1 min read · Post a comment

Most of the shared hosting platforms are providing SFTP access to the end-users as a secure file transfer protocol. There are a lot of free and open source GUI platforms for ftp, SFTP and SSH connections, but if you are a fan of the Linux command-line tool stay with me, as I’m about to show you how to establish a SFTP connection to a remote SFTP server.

Prerequisites

  • SFTP

How to connect with SFTP through command line

SFTP is a protocol that is leaning on SSH and uses the same method for authentication. So whether you want to connect through password or SSH keys it’s up to you, but the recommended and secure way is through SSH keys.

Step 1. To test the connection try to establish SSH connection.

ssh user@server_ip_or_remote_hostname

Step 2. If step 1 is working fine, run the sftp command.

sftp user@server_ip_or_remote_hostname

Output:

sftp>

Step 3. By default, SFTP is using the same default SSH port 22. If you want to open an sftp session on a different port, run:

sftp -oPort=some_port user@server_ip_or_remote_hostname

Conclusion

Once you are connected if you need to learn some useful SFTP command you can get help with:

sftp> help

For more specific requirements please don’t hesitate to raise a question below. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.