Upload File on FTP or sFTP Server with Shell on Linux

Script to upload file from Shell prompt in Linux or Crontab,

Script begins

#!/bin/sh
SERVER= XX.XX.XX.XX (IP address or host of ftp server)
USER=Username
PASSW=password

ftp -v -n $SERVER <<END_OF_SESSION
user $USER $PASSW
$FILETYPE
cd public_html (Path on FTP server)
lcd /var/www/ (Local Path on server from where you want to upload the file)
put Filename.txt (File name which you want to upload)
bye
END_OF_SESSION

Script End

Script to upload file from Shell prompt using FTP SSL in Linux or Crontab,

Script begins

lftp -u user_name,password sftp://IPaddress<< EOF
ls
bye
EOF

Script End

 

 

 

 

Categories: FTP, linux

Comments are closed.