Software & Apps Linux sftp - Linux Command - Unix Command Transfer files securely with the 'sftp' utility Share Pin Email Print Linux Switching from Windows 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 January 22, 2020 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 firstname.lastname@example.org 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:email@example.com. 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:firstname.lastname@example.org:download.txt When the file downloads, the session automatically terminates.