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
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.