Cloud backup with MCrypt and S3cmd
Put a Sock in It
A tool called Trickle [6] lets you segregate your precious bandwidth and stop S3cmd from hogging your Internet connection. To take control of your bandwidth, install the natty little third-party package with:
# apt-get install trickle
This superb utility is a userspace bandwidth-shaping tool that you can plug in to lots of applications. Apparently, the excellent Trickle cannot affect all bandwidth services but, rather, only those programs speaking to the network that use dynamic libraries (thanks to glibc), and it doesn't play nicely with packages that are linked statically.
Fret not, because you can check against the shared library dependencies of a piece of software using the ldd
command as follows. If you get any results displayed when running this command, it's good news, and Trickle should get on with the binary. The first example of this command shows a positive hit, and the second shows that you're out of luck:
# ldd /usr/bin/ssh | grep libc.so libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f69228de000) # ldd /usr/bin/apport-bug | grep libc.so #
If you're curious (and ideally not logged in as root, because you are being careful), try the following command-line quickie. This command gives you a quick look into the path /usr/bin
to check for the programs that Trickle supports:
# cd /usr/bin # for filelist in *; do ldd $filelist | grep libc.so; echo $filelist; done
I should mention at this point that v1.0.0 of S3cmd, which automagically appeared on my laptop from Ubuntu's repositories, didn't compile automatically with dynamic libraries. I did also have the libevent
library installed as suggested. The makers of the fantastic utility say that it should nevertheless work, and it is worth trying a newer version (v1.5.0 as I write) and compiling from source.
To limit half a megabit (Mb) of download capacity to your Amazon S3 activities, use the -d
switch:
# trickle -d 512 s3cmd get chrisfile.tar.gz.ncs3://aws-bucket-name
Conversely, you can choke the upload capacity with -u
:
# trickle -u 512 s3cmd put binnie_linux.doc.ncs3://aws-bucket-name
I got an error when I first attempted to run Trickle. The fix was to spawn a standalone mode. To do this, just add -s
to the command:
# trickle -s -u 512 s3cmd put cb_linux.doc.ncs3://aws-bucket-name
If all else fails, your other options for limiting bandwidth include the Throttle utility [7], as well as tc or iptables.
It's a Nice Place
Despite the somewhat heady mix of encryption methods available on Unix-like systems, the wide and varied selection provides enough choice for you to find the most efficacious tool for each job. I've attempted to demonstrate that, for some scenarios, you might want to use a built-in encryption system for ease (e.g., S3cmd supports GPG), and you might want to scrub your deleted files automatically and diligently by default. For compatibility reasons, on the other hand, you might want to use something old school like MCrypt, which works in all sorts of ways and is commonly adopted by PHP.
The mighty and ultra-reliable AWS storage service means you won't experience angst the next time you misplace a config file that you spent all morning getting to work.
I hope this article will encourage you to forge a creative solution to suit your own file backup needs.
Infos
- MCrypt: http://mcrypt.sourceforge.net/
- Bcrypt: http://bcrypt.sourceforge.net/
- S3cmd: http://s3tools.org/s3cmd
- GPG: https://www.gnupg.org/
- CloudFront: http://aws.amazon.com/cloudfront/
- Trickle: http://monkey.org/~marius/pages/?page=trickle
- Throttle utility: http://linux.die.net/man/1/throttle
« Previous 1 2 3 4 5
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.