Generate a Public/Private GPG Key Pair

I've had problems generating a GPG Key Pair, finaly found that it was because I was trying to generate the key with another user than the one I was logged with...

You must have a console opened to be able to generate the key.

...and a little script found here to automatically launch the gpg-agent :

#!/bin/bash
 
# Decide wether to start gpg-agent daemon.
# Create necessary symbolic link in $HOME/.gnupg/S.gpg-agent
 
SOCKET=S.gpg-agent
PIDOF=`pidof gpg-agent`
RETVAL=$?
 
if [ "$RETVAL" -eq 1 ]; then
        echo "Starting gpg-agent daemon."
        eval `gpg-agent --daemon`
else
        echo "Daemon gpg-agent already running."
fi
 
# Nasty way to find gpg-agent's socket file...
GPG_SOCKET_FILE=`find /tmp/gpg-* -name $SOCKET 2> /dev/null`
echo "Updating socket file link."
cp -fs $GPG_SOCKET_FILE $HOME/.gnupg/S.gpg-agent

Another little usefull command generating GPG Key Pair (this entropy stuff whatever...) is :

sudo dd if=/dev/sda of=/dev/zero

When you get "We need to generate a lot of random bytes. It is a good idea to perform <blabla>" open another shell and launch the command, it will accelerate the generation...