As part of my web hosting dealings I agreed to upload one of my (now ex-) clients’ sites to his new webhost. When I first offered I didn’t consider that the normal command-line FTP client (GNU FTP?) doesn’t recursively create subdirectories and stuff, so it was going to be an intensely laborious manual task of creating about fifty billion subdirectories; i.e. not possible.
As I do in these situations I unhesitatingly turned to Google, which came through with the goods in the form of
lftp (lftp man page), a command-line FTP client that has a ‘mirror -R’ (reverse mirror) that mirrors your local directory to a remote site. “Oh, bomb, that’s perfect,” I thought to myself, and gleefully found that it was indeed installed on our ancient Red Hat Enterprise Linux 3 server.
Well ye olde
lftp has some quirks and some foibles, at least for the young player like me. The foible I ran into was that lftp tries to make an SSL connection to the target server if it can. In my case it could indeed connect via SSL, but the SSL certificate wasn’t a “real” proper bought SSL certificate, it was a “fake” self-signed cert and lftp didn’t like that one bit. So it would connect to the remote server without complaining but then when I tried to make it do anything it would just refuse and say
cd: Fatal error: SSL connect: self signed certificate.
To get around this I had to edit the config file to disable connecting via SSL. I couldn’t find a command-line option to do this so editing the config file was my only option. This involved adding the line
ftp:ssl-allow false to the
/etc/lftp.conf file, which probably isn’t ideal since that’s for the entire system but pfft, whatever. You can also create a user-specific config file for lftp in your home directory called
~/.lftp/rc if you don’t have full root access or you don’t want to ruin everyone else’s fun ;).
After making this change I reconnected to the remote server with the following commands:
lftp -u newsiteusername newsite.example.com Password: lftp email@example.com:/> lcd /fake/local/website/directory lcd ok, local cwd=/fake/local/website/directory lftp firstname.lastname@example.org:/> cd fake/remote/website/directory cd ok, cwd=/fake/remote/website/directory lftp email@example.com:/fake/remote/website/directory> mirror -R
So that was the end of another enthralling adventure in the land of Linux web hosting.
You need to login to post comments!