Misc Linux things: PATA or SATA, mutt and mailcap, tarsnap backup

The other day, I wondered whether the drive in my laptop was PATA or SATA. Fortunately, I didn’t have to tear it apart to find out. I simply wandered over to stackexchange.com and asked the question. Here’s the answer:

lspci -d $(cat /sys/block/sda/device/../../../vendor):$(cat /sys/block/sda/device/../../../device)
readlink -f /sys/block/sda/device/../../../driver

I’m a long time user of the mutt email client (as well as Thunderbird). At some point, viewing the HTML attachment (with the ‘v’ key) stopped invoking ‘lynx’ via my mailcap file. It turns out that the developers of mutt added an internal viewer, and moved mailcap support to the “m” key. I took the time to switch from using ‘lynx’ to using ‘links’. Here’s the entry from my $HOME/.mailcap file:

text/html; /usr/bin/links -dump -force-html %s; copiousoutput; nametemplate=%s.html

I’ve been gradually looking for an online, off-site Linux backup tool forĀ  the past few years. I tried spideroak, but wasn’t pleased with the giant log files it kept in my home directory, and it wasn’t designed to back up files outside of my user account. Lately, I stumbled on another promising tool: tarsnap. I haven’t tried it yet, but I will. Pricing looks reasonable, and since it “deduplicates” storage, it means that I shouldn’t be backing up the same thing repeatedly. Here’s how one person configures tarsnap to keep up to X daily backups, Y weekly, and Z monthly.

Fedora 14, SSH ports and SELinux

SELinux in Fedora 14 is configured to constrain the ports on which SSH can listen (see the bug report). The solution:

setsebool -P sshd_forward_ports 1

This allows SSH to listen on ports besides 22, and to forward ports. Reading the bug report is interesting. In my opinion, OpenSSH has an outstanding security track record, and we probably don’t need additional SELinux policy to constrain it. It’s probably wise to practice security in-depth (to have more than one line of defense), but it creates a large road bump for most SSH power users. From what I read, it sounds like most people still disable SELinux.

Teriffic Linux Books

One of my QA coworkers had The Linux Phrasebook sitting on his desk. I noticed it was by Scott Granneman, and immediately thought, “if it’s by him, it’s got to be good.” As I thumbed through the pages of the book, I was impressed at the practical coverage of command line utilities including yum and rpm, apt and deb, etc. I highly recommend this book. It’s small so it’s easy to keep on hand.

For anyone wishing to write applications that take advantage of all that Linux has to offer, I recommend The Linux Programming Interface (also available from Amazon), aka TLPI. I used to recommend Stevens’ Advanced Programming in the UNIX Environment, but now I recommend TLPI because it is more comprehensive and just as readable. It’s not a small book, so a PDF makes it easier to keep on hand. I purchased my copy through the publisher, NoStarch with the coupon code “Mamaku” that gave me 30% off and a free PDF. The order total came to $80.00, including shipping.