File Sharing with FTP

With seven articles having been posted to my blog, it was time for a backup. I had been using the rpi-clone utility. But since the last backup I moved the boot media from an SD Card to a thumb drive. To my surprise the second USB 3 port on the Pi was not recognized. I decided for the purpose of the blog, that I would keep the thumb drive and use an alternative backup method.

Obviously, the backup had to be off the Pi itself. For me, the external device would be an Android tablet. Some choices were required. First, the file transfer protocol. In a recent article I discussed using the ** http** protocol. While this does work it is inefficient due to its dependence on a web browser. On the other hand, the **ftp** protocol is specifically designed for this purpose. Next, for each device, the Pi and the Android, we need a pair of ftp soft wares, an ftp server and an ftp client. The client is in control of the file transfers and should be on the Pi. The server on the Android.

Visiting the PlayStore. I found several that should work. I settled on one called FTP Tool. Before returning to the Pi, I configured the server with a username, password, and a specific directory on the Android that would hold backups. Most important are the blog posts. After that a zipped Pi home directory. Note, when configuring the server, the remote server name referred to later in this article is the local IP address. If the server is run a port other than port 21, that port must be included in the address. For example, if the local IP is 10.0.0.2 and the server is running on port 2121 then remote-address.com becomes 10.0.0.2:2121.

Returning to the Pi a client is needed. Again there many to choose from. Most are graphical, but that does not mean that they are easy to work with. One called lftp is used from the command line. Looking into this, I found a very long user manual that I definitely did not want to study. But I also found a few tutorials that indicated only a few commands were necessary to make good use of this app. It appears that a user could control file transfers with simple get and put commands. This was very appealing and I installed the app. Yes, it’s good. All the tutorials on this are good but I particularly liked this one .

The article begins with a variety of ways to connect to the server. Take your pick remembering the syntax for the remote server described above. I connected with lftp ftp://don@10.0.0.2:2121. The system asked for my password. With a connection established, you can now issue bash commands to the several. Commands like ls, cd and pwd will work as expected. The command lcd will allow you to change the local directory if needed. To see the files in the local directory issue the command !ls. The exclamation character acts like an escape character. So the command !pwd will return the name of the local directory. You can now get and put files to and from the server. Very nice indeed. Follow the tutorial for further instructions.

I composed this article on an Android tablet. It will take the journey described above.

Hits