From LQWiki
Jump to: navigation, search

Secure File Transfer Protocol or SFTP is a secure version of FTP that uses SSH. In short, when transferring files over the Internet, SCP and SFTP are far superior to the older, unencrypted methods of file transfer.

Files on an SFTP server may be used directly by any program if mounted using sshfs.

Using SFTP

The SFTP program provides the simplicity of the normal Unix "ftp" client program, but with the security of SSH. Unlike normal FTP, you must specify your username with the host in SSH-style syntax:

$ sftp user@hostname.org
Connecting to hostname.org...
user@hostname.org's password: <Enter password here>

If you do not specify a user the value in $USER is assumed. At this point many of the familiar ftp commands can be used (cd, lcd, pwd, ls, get, put). SFTP has some new commands the normal FTP client doesn't have, like chown, chgrp, lpwd (local pwd command), lmkdir (local mkdir command), ln (make symlink), and many others. Many of the old FTP commands are obsoleted and are no longer necessary because of the different SSH protocol (like passive, type) and SSH has no need for PORT, PASV, TYPE (raw FTP commands), etc.

See also