views:

391

answers:

3

Hi,

I am using dozens of different web services, and I keep a password file in a remote Linux machine. The file contains my usernames, passwords and answers for security question.

This server happens to be offline to often, and I'm looking for a way to keep the password file on my own computer, or on a service like DropBox. Obviously, I want to keep the file encrypted, but handy - I want to be able to print its contents using one shell (or cygwin) command, perhaps using a passphrase.

Any good ideas how to do it?

+3  A: 

You can use GPG's symmetric option to encrypt files with pass-phrases.

gpg --symmetric filename

That will result in an encrypted file named filename.gpg. To redirect the output to STDOUT instead of a .gpg file:

gpg --symmetric -o - filename

You can later decrypt the file with:

gpg --decrypt filename.gpg
Alan Haggai Alavi
I have read about gpg, but how can you pass the output to the standard output rather than to the .gpg file?
Adam Matan
I have updated the code.
Alan Haggai Alavi
OK, It's the usual "-o". I should have googled harder (trying "stdout", not only "standard output"). Thanks!
Adam Matan
+2  A: 

I use PasswordSafe encrypted files in exactly this configuration. GUIs are available for Windows/Mac/Unix/Java. cliPSafe gives it a command line interface.

THe original code was written by Bruce Schneier, well known in the security world, but I've never used cliPSafe.

Nick Fortescue
Thanks, I'll look into it.
Adam Matan
+1  A: 

As already noted GPG solves the problem. Using the gpg command directly for encrypting text files may be a bit cumbersome though, especially as you would often decrypt the file to a seperate file, add some text (passwords in this case) and the reencrypt it (which will possibly expose your unencrypted data).

Vim has a very good plugin called gnupg for trasparently handling encrypted files using GPG. Using this plugin the unencrypted data will never be written to disc and you can just treat it as any other file (except for the passphrase question popping up of course).

Mikael Auno
Wow, that's great. Found the link. Thanks!
Adam Matan