How To Easily Use SFTP To Download and Upload Files Securely
SSH File Transfer Protocol is a secure protocol for transferring files between a local and a remote server. On the remote system, an SSH server is needed. The data transfer between the local and remote systems is encrypted using this protocol. We prefer SFTP over FTP because it offers secure data transfer.
Table of Contents
While SFTP is preferred, if you only have access to a remote FTP server, use the link below for FTP access.
How to Connect To SSH Server
SFTP establishes a connection to the ssh server. On the remote device, the ssh server must be running. To bind to the example.com server as user Yehiweb, type the following command.
$ sftp email@example.com
$ sftp -P 2222 firstname.lastname@example.org
A sftp prompt will appear after successful authentication. Where you can securely download or upload files. On the sftp prompt, type help to get a list of available commands.
sftp> help Available commands: bye Quit sftp cd path Change remote directory to 'path' chgrp grp path Change group of file 'path' to 'grp' chmod mode path Change permissions of file 'path' to 'mode' chown own path Change owner of file 'path' to 'own' df [-hi] [path] Display statistics for current directory or ... ...
How to change the Local and Remote Directories
sftp> !pwd /home/ubuntu sftp> pwd /home/yehiweb
- ! pwd – This command is used to search the existing directory on a local system.
- pwd – This command is used to determine the existing directory on a remote system.
sftp> lcd /home/ubuntu/Downloads sftp> cd Uploads
- lcd – On a local system, the lcd is used to navigate between directories.
- cd – On a remote system, cd is used to navigate between directories.
How To Download Files From SFTP
To download a file from an sftp server to your local system drive, use the get command. To change the location of the local download folder, type lcd. The command below will download remotefile.txt from a remote system to your local system.
sftp> get remotefile.txt
-r switch with the get command to import files and directories in a recursive manner. The command below would recursively download the folder remotedir from the remote system to the local system.
sftp> get -r remotedir
How To Upload Files to SFTP
To upload a file from a local system to a remote system, use the put command. To begin, change the location of the remote upload folder using cd. The command below would move
localfile.txt from a local system to a remote sftp server.
sftp> put localfile.txt
-r switch with the put command to upload files and directories in a recursive manner. The command below will upload the localdir directory, as well as all files and subdirectories, to a remote server.
sftp> put -r localdir
Top 6 Tips on Getting One of the Highest Paying Jobs in Oregon: Make Sure You Stand Out Among the Crowd
Job hunting is more than applying for vacant positions and waiting for interviews. It is a demanding task that requires…