Pages

Friday, June 2, 2017

How to Upload or Download Files/Directories Using sFTP in Linux

sFTP (secure File Transfer Program) is a secure and interactive file transfer program, which works in a similar way as FTP (File Transfer Protocol). However, sFTP is more secure than FTP; it handles all operations over an encrypted SSH transport.
It can be configured to use several useful SSH features, such as public key authentication and compression. It connects and logs into the specified remote machine, and switches to an interactive command mode where user can execute various commands.
In this article, we will show you how to upload/download a whole directory (including it’s subdirectories and subfiles) using sFTP.

How to Use sFTP to Transfer Files/Directories in Linux

By default, SFTP adopts the same SSH transport for establishing a secure connection to a remote server. Although, passwords are used to authenticate users similar to the default SSH settings, but, it is recommended to create and use SSH passwordless login for simplified and more secure connection to remote hosts.

Connect to Remote FTP Server Securely

To connect to a remote sftp server, first establish an secure SSH connection and then create an SFTP session as shown.
$ sftp tecmint@192.168.56.10
Once you have logged into the remote host, you can run interactive sFTP commands as in the examples below:
sftp> ls   #list directory 
sftp> pwd   #print working directory on remote host
sftp> lpwd   #print working directory on local host
sftp> mkdir uploads  #create a new directory
Run sFTP Commands on Remote Linux
Run sFTP Commands on Remote Linux

How to Upload a Directory Using sFTP

In order to upload a whole directory to a remote Linux host, use the put command. However, you will get an error if the directory name doesn’t exist in the working directory on the remote host as shown in the screenshot below.



      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
                                                    ► Read more: http://adf.ly/1n5ZDT
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

No comments:

Post a Comment