3 ways to automate file transfers using ftp
Introduction In some of our earlier articles we’ve explained the setting up of chrooted sftp and chrooted ssh accounts along with the setup of an ftp server using vsftpd. In today’s automation driven enterprise infrastructure environments we may often find ourselves in situations where we need to automate the transfer of files using the ftp/sftp protocol. Setting up passwordless tranfer of files using sftp is farily stragithforward. Since sftp is based on the ssh protocol we can generate and use ssh keys to setup passwordless authentication to allow for automated file tranfers. In this article we will demonstrate three techniques using which you can automate the transfer of files using FTP protocol as well. Method 1: Using wget The wget command provides options to connect to the ftp server and download a file while specifying the credentials on the command line. In the below example, we connect to the ftp server with IP address 172.31.18.17 using the user name sahil and password as L#giN@123 and download the file download.txt. [root@sahilsuri0081 ~]# wget --user=sahil --password='L#giN@123' ftp://172.31.18.17/download.txt --2018-07-27 17:39:40-- ftp://172.31.18.17/download.txt => ‘download.txt’ Connecting to 172.31.18.17:21... connected. Logging in as sahil ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD not needed. ==> SIZE download.txt ... done. ==> PASV ... done. ==> RETR download.txt ... done. [ <=> ] 0 --.-K/s in 0s...
Read More