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.
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.
2. This second example, we will copy the file test_scp_on_server.txt from remote server to localhost.
SSH File Transfer with SFTP Command
2. Show the current directory on both remote host and localhost
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
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.