SFTP (Secure File Transfer Protocol)
SSH is used not only for remote login but also for file transfer in a secure way. There are two protocols to transfer files with SSH – SCP (Secure Copy Protocol) and SFTP (Secure File Transfer Protocol). In this section, we'll explain SFTP.
SFTP session and sub-commands
Unlike with SCP, after running the SFTP command, the SFTP session continues until you exit the session. Once the SFTP session is established, you can run sub-commands prepared for SFTP.
Establish SFTP session
There are two approaches to establishing an SFTP session – 1) without the SSH config file, and 2) with the SSH config file. The syntax is almost the same as the one of SSH. You can simply replace ssh
with sftp
.
Without the SSH config file, you need to specify the private key file path, user name, and IP address of the remote server.
sftp -i ~/.ssh/id_rsa ubuntu@54.169.91.239
With the SSH config file, the command is much simpler. Just type ssh
and the SSH host name in your config file (the example below uses ssh_test a
Subscribe now for
uninterrupted access.