Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Red Hat – LFTP File Upload

Posted on September 26, 2018 By David Kittell
#!/bin/sh

# LFTP.sh
# 
# Created by David Kittell on 9/26/2018.
# 

if ! rpm -qa | grep -qw lftp; then
    echo "Installing lftp"
    yum install lftp -y
else
    echo "lftp is already installed"
fi

# lftp profile creation example
lftp -c "bookmark add SiteName ftp://user:password@sitename.com/path"
#lftp -c "bookmark add SiteName ftp://user:password@sitename.com:2121/path" # For a different FTP port

# If you are using SFTP it's better to use this line
#lftp -c "bookmark add SiteName sftp://user:password@sitename.com/path"
#lftp -c "bookmark add SiteName sftp://user:password@sitename.com:2121/path" # For a different FTP port

# lftp upload file
lftp -c "open SiteName && lcd MyLocalDir && mput ./"*

If you run into issues with SSL certificate verification the below should help.
NOTE: Even though we backup the original configuration, test this on a development server first.

# Disable SSL Verification - Start
# If you are running into problems with SSL certification verification
sudo cp /etc/lftp.conf /etc/lftp.conf.original_`date +%Y_%m_%d_%H.%M.%S`
sudo sed -i "/^\s*#/d;s/\s*#[^\"']*$//" /etc/lftp.conf && sudo sed -i '/^\s*$/d' /etc/lftp.conf
echo "set ssl:verify-certificate no" | sudo tee -a /etc/lftp.conf
# Disable SSL Verification - Stop
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

CentOS Code Fedora Red Hat UNIX UNIX Shell Scripts

Post navigation

Previous post
Next post

Related Posts

MySQL Procedure Get WordPress Site Name

Posted on October 13, 2015October 13, 2015

If you manage many WordPress site databases it can get a bit crazy to know which site goes with what database but it gets more “fun” when you have a network site, below I attempt to help document some ways to help. This first example is a rather long process…

Read More

Bash – Get ARIN IP Information

Posted on July 16, 2021August 17, 2024

A bit crude but works # Prerequisite: brew install ipcalc # Place all the IP Addresses in a text file IPList.txt echo "IP Address|Root Owner|Owner|IP CIDR|IP RDNS" | tee ARIN.txt for ip in $(cat IPList.txt | sort); do arin=$(whois -h whois.arin.net "$ip") rootOwner=$(echo "$arin" | grep ‘Organization’ | cut -d…

Read More

Mac OSX – Bash – Fix WiFi

Posted on July 19, 2018

#!/bin/sh # FixWiFi.sh # # # Created by David Kittell on 1/17/18. # cd ~/Desktop mkdir WiFiConfigBackup networksetup -setairportpower airport off mv /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Desktop/WiFiConfigBackup mv /Library/Preferences/SystemConfiguration/com.apple.network.eapolclient.configuration.plist ~/Desktop/WiFiConfigBackup mv /Library/Preferences/SystemConfiguration/com.apple.wifi.message-tracer.plist ~/Desktop/WiFiConfigBackup mv /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist ~/Desktop/WiFiConfigBackup mv /Library/Preferences/SystemConfiguration/preferences.plist ~/Desktop/WiFiConfigBackup shutdown -r now All information on this site is shared with the intention to…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes