Thursday, October 06, 2005

GPG and ssh-keygen

I never can remember these commands, mainly because I don't use them that often.

Before using GPG, create the directory:
mkdir ~/.gnupg; chmod 700 $_
Now, encrypt a file:
gpg -c /path/file
Encrypted file is created as /path/file.gpg.
To decrypt to standard output:
gpg -d /path/file.gpg
(You might want to redirect to another file.)

To use SSH without a entering a password, we do a key exchange. First we need a key pair:
ssh-keygen -t dsa
The key is stored as ~/.ssh/
Transport the key to the remote system, then add it to SSH:
cat >> ~/.ssh/authorized-keys
If the permissions are not correct, the login will fail.
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Make sure to check permissions on both sides!

No comments:

Post a Comment