Transferring file through SFTP using Raspberry Pi Terminal

Transferring file through SFTP using Raspberry Pi Terminal

0 comments

Introduction

Security has become one of the major concerns nowadays due to security breaching. When it comes to transferring files over the internet, the first thing that comes to our mind is whether it is safe or not. SFTP is one of the secure protocols to transfer the files over the internet. 

SFTP (Secure file transfer protocol) is a protocol to transfer or access the data over the Secure Shell (SSH) data stream thus providing security in an organization while transferring files.

One of the easiest ways is to transfer a file using software FileZilla that works on FTP. Simply download the software, connect to the server and select the file to be transferred and click on upload.

FileZilla

In this blog, we are going to see how to transfer a file from one Raspberry Pi to the other. There are various ways to transfer files like by uploading them on your drive and then download it from the drive to the other pi or by using software like Filezilla, etc. Here, we will learn how to transfer files using SFTP from the terminal.

In this tutorial, we’ll

  • download a file/directory from a remote Raspberry Pi Device,
  • upload file/directory to remote Raspberry Pi Device.

Downloading the file :

Step 1: Establish the connection with remote Raspberry Pi

sftp username@ipaddress 

Username - remote username of the server.

IP address - IP of the server or you can also use a host name.

If the username and host name are correct it will ask for the password of the remote device.

Raspberry Pi

Step 2: Download 

  • To download a file use get command with filename, as

get “filename”

Raspberry Pi

  • To download a directory use “-r” recursive command, as

get -r “directory name”

Raspberry Pi

Note: While downloading the file/directory change the file or directory name.

get -r “filename” “new_filename”
get -r “directory name” “new_directory name”

Uploading the file :

Step 1: Establish the connection with remote Raspberry Pi device.

sftp username@ipaddress 

Username - remote username of the server.

IP address - IP of the server or you can also use a host name.

If the username and host name are correct it will ask for the password of the remote device.

Raspberry Pi

Step 2: Upload

  • To upload a file, use put command with filename, as

put “filename”

Raspberry Pi

  • To upload a directory, use “-r” as recursive uploading, as

put -r “directory name”   

Raspberry Pi

After the transfer of files is done disconnect from the remote server by using the commands 

“exit”  / “quit”  / “bye”

Raspberry Pi

In this way, you can transfer a file/directory over the internet securely using commands.

We often ignore these simple tools and commands and download software. These simple commands can save us a lot of time. And next time when you are using the software, you already know how it works. Have fun with your Raspberry. 

 

This article is published by SB Components, Enjoy reading it..

Get Raspberry Pi 4 Training Book Free with Raspberry Pi 4 Kit


INSTALLATION OF OPERATING SYSTEM IN RASPBERRY PI

RASPBERRY PI HARDWARE SETUP

Leave a comment

Please note, comments need to be approved before they are published.