sftp,

How to connect with SFTP through command line

Jan 11, 2022 · 1 min read · Post a comment
How to connect with SFTP through command line

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 an 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

Example 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.