SSH File Transfer Protocol
lastmod 2025-11-13created 2024-07-232 edits
In computing, the SSH File Transfer Protocol, or Secure File Transfer Protocol (SFTP), is a network protocol that provides file access, file transfer, and file management over a reliable data stream. It was designed by the Internet Engineering Task Force (IETF) as an extension of Secure Shell protocol (SSH) version 2.0 to provide secure file transfer capability. The IETF Internet Draft states that, even though this protocol is described in the context of the SSH-2 protocol, it could be used in a number of different applications, such as secure file transfer over Transport Layer Security (TLS) and transfer of management information in VPN applications.
This protocol assumes that it is run over a secure channel, such as SSH, that the server has already authenticated the client, and that the identity of the client user is available to the protocol.
Capabilities
Compared to the SCP protocol, which only handles file transfers, the SFTP protocol allows a range of operations on remote files, which makes it more like a remote file system protocol. Additional capabilities of an SFTP client include resuming interrupted transfers, directory listings, and remote file removal.
SFTP tends to be more platform-independent than SCP. For example, with SCP, the expansion of wildcards specified by the client is up to the server, whereas SFTP's design avoids this problem. While SCP is most frequently implemented on Unix platforms, SFTP servers are commonly available on most platforms.
SFTP is not FTP run over SSH, but rather a new protocol designed from the ground up by the IETF SECSH working group. It is sometimes confused with the Simple File Transfer Protocol.
The protocol itself does not provide authentication and security; it expects the underlying protocol to secure this. SFTP is most often used as a subsystem of SSH protocol version 2 implementations, which are designed by the same working group. However, it can also be run over SSH-1 and implementations that support it, or over other data streams. Running an SFTP server over SSH-1 is not platform-independent, because SSH-1 does not support the concept of subsystems. An SFTP client that wants to connect to an SSH-1 server must know the path to the SFTP server binary on the server side.
Uploaded files may be associated with their basic attributes, such as timestamps. This is an advantage over the common FTP protocol, which means that uploads do not need to be provided separately to include the original date/timestamp attributes.
Copying a directory recursively
Use the -r option with a command such as put.
Speed limit
Use the -l limit option. The unit is Kbps/s !!!! (not KB/s)
- For 1MB/s per second, enter
1 * 1024 * 8=-l 8192. - For 2MB/s per second, enter
2 * 1024 * 8=-l 16384.
Private Key File Path
If you need to specify the private key file path explicitly, use the -i option.
Or use the -o option.
See also
- openssh
- ssh
- rsync
- sshfs (Python) - A Python client that implements fsspec. Based on asyncssh.
- SSHFS (FUSE) - A client for mounting that uses FUSE
- aria2 - Fast multi-protocol, multi-download command line.
- FTP
- SCP