SSH Secured File Transfer Protocol (SFTP)

By | August 31, 2020

What is SSH File Transfer Protocol

SSH File Transfer Protocol (SFTP) is is a secure file transfer protocol running over SSH connection of port 22, which is replacing the legacy FTP protocol. It supports security and authentication functionality.

If you are on Windows Operating system and you want to transfer files between your Windows client to Linux server, there multiple tools that you can use to transfer such as WinSCP and FileZilla. However, if you want to transfer file between Linux servers, SCP and SFTP commands are the best ways for this file transitions.

SSH File Transfer with SCP Command

1. We are going to copy a file named test_scp.txt from localhost (cent_client) to remote server (cent_srv01) using scp command.

The syntax is scp [option] Source Target
scp scp_on_client/test_scp_txt  itgeek@

2. This second example, we will copy the file test_scp_on_server.txt from remote server to localhost.

    scp itgeek@      

SSH File Transfer with SFTP Command

1. Let connect to remote server using SFTP using sftp itgeek@

2. Show the current directory on both remote host and localhost

    Show on remote host: pwd
    Show on localhost: !pwd

3. We can also list the file/directory on remote host and localhost

4. Now let upload a file named sftp_on_client_testfile.txt to remote server using PUT command

5. We can also download the file from remote host to localhost using the GET command.

So that’s how we can use SFTP protocol to transfer file between Linux hosts. Not only transferring file, with sftp command, you also can create a directory using mkdir command, delete directory using rmdir command, and delete file using rm command on the remote host.

Leave a Reply

Your email address will not be published. Required fields are marked *