Diary Data (2026-03-30_blog_nuke.txt)

Hey! iDestyKK here. Alright, let's talk about an important lesson about FTP/SFTP, copying, and overwriting files.

The magic command: lftp

When I write websites, such as my blog or this page, I write an instance of it locally. Then I utilise a command called lftp to copy all of the files over to a web server that actually hosts the site on my domains. In the case of this website, the command is:

Bash Command
lftp -e "mirror -R . /vhosts/claranguyen.me/htdocs --exclude .git" sftp://user@host

Computers are dumb. They will listen to you without questioning you. So, when you run a command like this, it will just... copy over all of the files in a directory over without question. For copying files over to my blog, I simply run this command:

Bash Command
lftp -e "mirror -R . /vhosts/blog.claranguyen.me/htdocs --exclude .git" sftp://user@host

Do you see the difference? Each subdomain simply has its own directory and I simply changed it from claranguyen.me to blog.claranguyen.me. Very simple.

The mistakes

Mistake #1: Accidental merging

The command I have up above is saved in my diary for updating my blog only. However, recently, I had to update my main site because I joined the Off-Platform Webring. So I needed to update the main page via lftp. But I accidentally copy-and-paste'd the wrong command and sent my main site's code over to my blog!

This didn't nuke any files. But instead, it caused a huge mess where the files of both websites were merged together, with the main page's taking priority and overwriting files on the server of the same name. Whoops! Thankfully, I had a backup of my blog.

Mistake #2: Accidental beta push

Locally, I actually have 2 versions of my blog. One is a beta build that hosts unpublished blog posts. I use this to type up my blog posts and then, when ready, copy the files over to the deployment version to copy over to the server. I accidentally pushed the beta version over to the web server instance. I was wondering why the copy was taking so long! It was uploading tens of unpublished blog posts.

On Gandi, I had to enable the emergency console, SSH in, and nuke the entire directory. Then, I had to rerun the lftp command a third time, in the correct directory, to ensure the correct files were copied over. This took a few minutes to upload. In short, the entire blog had to be nuked and re-copied over from scratch.

The lesson here

Don't just blindly copy-and-paste code. Even if it is something you wrote yourself. I was stupid for one second and my blog went down for about 10 minutes because of it. Sorry if someone just happened to try and view it during that time...