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
-
2024 Open Source Professionals Job Survey Now Open
Share your expectations regarding open source jobs.
-
Arch Linux 2023.12.01 Released with a Much-Improved Installer
If you've ever wanted to install Arch Linux, now is your time. With the latest release, the archinstall script vastly simplifies the process.
-
Zorin OS 17 Beta Available for Testing
The upcoming version of Zorin OS includes plenty of improvements to take your PC to a whole new level of user-friendliness.
-
Red Hat Migrates RHEL from Xorg to Wayland
If you've been wondering when Xorg will finally be a thing of the past, wonder no more, as Red Hat has made it clear.
-
PipeWire 1.0 Officially Released
PipeWire was created to take the place of the oft-troubled PulseAudio and has finally reached the 1.0 status as a major update with plenty of improvements and the usual bug fixes.
-
Rocky Linux 9.3 Available for Download
The latest version of the RHEL alternative is now available and brings back cloud and container images for ppc64le along with plenty of new features and fixes.
-
Ubuntu Budgie Shifts How to Tackle Wayland
Ubuntu Budgie has yet to make the switch to Wayland but with a change in approaches, they're finally on track to making it happen.
-
TUXEDO's New Ultraportable Linux Workstation Released
The TUXEDO Pulse 14 blends portability with power, thanks to the AMD Ryzen 7 7840HS CPU.
-
AlmaLinux Will No Longer Be "Just Another RHEL Clone"
With the release of AlmaLinux 9.3, the distribution will be built entirely from upstream sources.
-
elementary OS 8 Has a Big Surprise in Store
When elementary OS 8 finally arrives, it will not only be based on Ubuntu 24.04 but it will also default to Wayland for better performance and security.