If you want to encrypt a file or a folder in Linux by using a gui then you are lucky. In Ubuntu and Linux Mint there is an option in right click menu in the file managers (nautilus and nemo respectively). To enable this, in Ubuntu install nautilus-seahorse and in Linux Mint nemo-seahorse from Synaptic.
Now you can right click in every file or folder you want to encrypt, select “Encrypt” and you will be presented with a dialog.
If you “use a shared passphrase” you will be asked to set the encrypted file/folder name and then you will be asked for a password. Everytime you want to decrypt that file/folder you will be asked for your password. But beware … not exactly every time…
Encryption/decryption is taken care by a program called gpg. This program cooperates with a running agent called gpg-agent.. Unfortunately this agent caches the passwords for some time so if you try to decrypt one file soon after you decrypted it for the last time (e.g. 10mins after your last decrypt) you will not be asked for a password. In my case this is not wanted as I want to always be asked for a password when trying to decrypt.
To solve this problem create a file named gpg-agent.conf in folder ~/.gnupg and put the following lines inside:
# Expire cached PINs (passphrases) after zero seconds
default-cache-ttl 0
max-cache-ttl 0
This will tell gpg-agent to not cache any password, so you will asked for a password everytime you try to decrypt.
To enable the new configuration run:
gpgconf --kill gpg-agent
This will stop the gpg-agent. The agent will start automatically the next time you will try to encrypt/decrypt.