Software & Apps Linux sftp - Linux Command - Unix Command Transfer files securely with the 'sftp' utility by Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated on January 22, 2020 Linux Switching from Windows Tweet Share Email The sftp utility is an interactive file transfer protocol, similar to ftp, but which performs all operations over an encrypted SSH transport. It may also use many features of SSH, such as public-key authentication and compression. sftp connects and logs into the specified host then enters an interactive command mode. Synopsis The command accepts the following general forms: sftp [-vC1 ] [-b batchfile ] [-o ssh_option ] [-s subsystem | sftp_server ] [-B buffer_size ] [-Fssh_config ] [-P sftp_server path ] [-R num_requests ] [-S program ] hostsftp [[user@]host[:file [file]]]sftp [[user@]host[:dir[/]]] Typical Usage The sftp utility is most often invoked interactively. That is, you launch the utility in a shell session by specifying a specific location and, optionally, your credentials. For example, to access server.com, execute: sftp server.com The utility obtains the security key for server.com and, if it's the first time you've connected, you'll be asked to add it to your list of known hosts. You'll then be prompted to log in, according to the protocol of the SFTP server on the remote host. It's convenient to bypass interactive logins by specifying your credentials as part of the connection command. To log in to server.com as user test, execute: sftp email@example.com You'll be prompted for your password. Once logged in, browse the remote filesystem using standard FTP commands. How to Use the FTP Command in Linux Specify a password with a colon after the username. For example, execute sftp test:firstname.lastname@example.org. Storing passwords in plain text is a security risk, so use this shortcut with caution. Non-Interactive Sessions If you specify a file as part of the connection string, then when you're authenticated to the remote server, sftp obtains the remote file and stores it in the current working local directory. For example, the following command retrieves a file (download.txt) from a specified server (server.com) by a specific user (test) and using a password (password): sftp test:email@example.com:download.txt When the file downloads, the session automatically terminates.