Wade Murray @wademurray – 2016-11-18T15:40:37+00:00
1 organ donor can save as many as 8 lives. Join me and #DonateLife by signing up in the Health app on iPhone or at https://t.co/BRhAoEYfsg
Posted using Twitter for iPhone
Wade Murray @wademurray – 2016-11-18T15:40:37+00:00
1 organ donor can save as many as 8 lives. Join me and #DonateLife by signing up in the Health app on iPhone or at https://t.co/BRhAoEYfsg
Posted using Twitter for iPhone
Random pictures taken on July 23, 2016 in Petersburg, Virginia. #badPhotography
I bought two of these pulleys for my G5RV antenna. Nylon cord comes from the antenna’s insulators and is tied to a brick on each side. This allows the antenna to move with the wind or a tree limb.
Wade Murray @wademurray – 2016-06-04T04:27:41+00:00
RT @Bonney: I made some wallpapers that combine the classic six-color Apple logo with the WWDC16 color scheme: https://t.co/RyI762wPlN
http://www.bonney.io/wallpaper
Posted using Twitter for iPhone
Wade Murray @wademurray – 2016-02-06T18:39:12+00:00
RT @Bill_Gross: Awesome new Mars panorama from 35 million miles away! https://t.co/F9VpZontPG https://t.co/obGBEfnCxj
http://www.jpl.nasa.gov/spaceimages/details.php?id=PIA20316
Posted using Twitter for iPhone
Rsync, for those who aren’t familiar, is a file copy tool, which, after the first copy, will only send changes during subsequent updates. This makes it a very efficient tool, especially when used over an internet connection.
Anyway, to enable rsync from server A to server B, it is common to perform the login via key. This means that on Server A you’d generate a SSH keypair for your backup user, then copy the public key that was generated into the ~/.ssh/authorized_keys
file for your backup user on Server B.
Because rsync is going to be executed automatically via cron script, it is necessary to create the key file without a password.
/etc/ssh/sshd_config
ChrootDirectory %h AllowTcpForwarding no PermitTunnel no X11Forwarding no
Note, because of the way chroot works, you’ll need to make sure the chroot directory is owned by ROOT, even if it’s actually the home directory of your backup user.
This gets you part of the way, you should now be able to SSH/SFTP into Server B using your backup user, and when connected, you will be restricted to the location set in ChrootDirectory
.
Unfortunately, rsync needs more than this, and in order to copy files it’ll need access to the shell (I’m assuming bash
), as well as the rsync application itself, together with whatever libraries are required.
Therefore, it becomes necessary to create a partial chroot image in the backup user’s chroot directory. You could do this the traditional way (e.g. by using something like debootstrap
), which will create a mirror of your base operating system files in the chroot jail. However, this generally takes a few hundred megabytes at least, and if all you want is to copy some files, you don’t want to give access to more than you need.
Instead, I opt to create a skeleton chroot jail by hand.
The goal here is to mirror the filesystem of your server inside the chroot jail, so that if a file exists in /foo/bar
, then you need to copy it to /home/backup-user/foo/bar
, and make sure it’s owned by root.
/bin/bash
to the directory
/home/backup-user/bin/
/usr/bin
)
ldd
to interrogate the executable and get a list of files to copy, e.g:
root@server-b:/home/backup-user# ldd /bin/bash linux-vdso.so.1 => (0x00007fff52bff000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f412810a000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4127f06000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4127b79000) /lib64/ld-linux-x86-64.so.2 (0x00007f4128340000)
Copy the files which have directories into the appropriate locations, e.g./lib/x86_64-linux-gnu/libtinfo.so.5
should go into
/home/backup-user/lib/x86_64-linux-gnu/
/usr/bin/rsync