Craig Box's journeys, stories and notes...


Archive for February, 2007

GPG agent doesn't prompt for my passphrase

Thursday, February 22nd, 2007

Something that has always bothered me; I use the gpg-agent program to cache my passphrase in memory, but if I call it from dpkg-buildpackage or falcon, it just does this:

You need a passphrase to unlock the secret key for
user: "IT Partners <packages@itpartners.co.nz>"
1024-bit DSA key, ID xxxxxxx, created 2005-04-21

gpg: cancelled by user
gpg: skipped "xxxxxxxx": bad passphrase

Why does it punish me so? Turns out that pinentry, the program that asks for the passphrase, can't find a terminal, so can't run, and the key doesn't get cached.

To fix this, you can set the GPG_TTY variable, which I do in my .bashrc like so: export GPG_TTY=`tty`

Problem solved. And added to the WLUG wiki for posterity.

Copying file permissions with robocopy

Tuesday, February 13th, 2007

I like using rsync to copy files between PCs, even on Windows. You get all the niceness of copying when the files are in use, and then only doing a small synchronization when they're not, to get a complete copy.Doesn't handle Windows file permissions well though.

Enter Robocopy (available in the Resource Kit). But I've already got the files?

robocopy source dest /s /copy:sou /is

Copies only security, owner and auditing information. Very handy.