sftp is a client application provided by SSH, which is mainly used to access FTP securely. Because FTP is a non-encrypted protocol and is very insecure,
sftp is equivalent to putting FTP into SSH.
The following command connects to the FTP host.
$ sftp username@hostname
Execute the above command, you will be asked to enter the FTP password. After the password verification is successful, the FTP prompt
sftp> will appear. The following is an example.
$ sftp USER@penguin.example.com USER@penguin.example.com's password: Connected to penguin.example.com. sftp>
Below the FTP prompt, you can enter various FTP commands. This part is exactly the same as the traditional FTP usage.
ls [directory]: List the contents of a remote directory. If the target directory is not specified, the current directory will be listed by default.
cd directory: change from the current directory to the specified directory.
mkdir directory: Create a remote directory.
rmdir path: Delete a remote directory.
put localfile [remotefile]: transfer local file to remote host.
get remotefile [localfile]: The remote file is transferred to the local.
help: Display help information.
bye: Exit sftp.
quit: Quit sftp.
exit: Exit sftp.