How to encrypt zip file

Some workplaces have tight restrictions on email attachments containing binaries. So, people in such environments request me to send the attachment by zipping up the suspicious files and encrypting it. Zip has had support for password protection for a long time so most receivers will be able to unzip the contents if you can provide the password you used for encrypting.

To create the zip files:

$ zip --password mypassword files to zip go here

Note that zip uses weak encryption. Use it only to get around the email servers, not for actually hiding data.

Tried with: Ubuntu 14.04

How to use KeeFox in Ubuntu

KeeFox is an open-source extension for Firefox to use your KeePass program to fill login-password forms on websites. You could do this manually by opening KeePass and using it to find the login-password or to generate a new password or update the credentials. KeeFox makes it easy to do these operations directly from the browser.

$ sudo apt install keepass2
  • Open KeePass and create a password database and a master password. Get comfortable using KeePass. Configure it to open your default password database file on startup.

  • Install the complete Mono package:

$ sudo apt install mono-complete
  • Make sure you install mono-complete. Just because you have /usr/bin/mono does not mean that this package is installed. If you do not install this, you will later face a plugin incompatibility error.

  • Install the KeeFox extension in your Firefox from here.

  • We now need to create a plugins directory in our KeePass installation and copy the plugin file provided by KeeFox to that location:

$ cd /usr/lib/keepass2/
$ sudo mkdir plugins
$ sudo cp $HOME/.mozilla/firefox/*.default/extensions/keefox@chris.tomlinson/deps/KeePassRPC.plgx plugins
  • Open KeePass. If you had it open, close it and open it again. It should acknowledge that the new plugin that you installed in the above step. Keep it open for the steps below.

  • Open Firefox. Click on KeeFox and go to Options. In the KeePass tab, enter /usr/lib/keepass2 as KeePass location. The Mono location should already be filled in correctly.

  • Restart Firefox. Open the KeeFox Tutorial webpage. Follow the steps there and it shows you how to pull a login-password from KeePass to fill web forms, how to create and update a new password or add a new entry to the database.

Note: After going through these steps I realized that it is far easier to manually use KeePass instead of KeeFox. This is because login-passwords need only be entered once and can be saved for all future logins in Firefox using its built-in password manager anyway.

Tried with: KeeFox 1.5.3, Firefox 42, KeePass 2.25 and Ubuntu 14.04

How to issue password in ssh command

The ssh command can be passed the name of the host computer and your login on it. After this it asks for the password. However, you may sometimes want to issue the password along with the ssh command.

One possible solution for this is to use the sshpass tool. The tool can be installed easily from the Ubuntu repositories:

$ sudo apt-get install sshpass

To issue your password along with your ssh command, use this:

$ sshpass -p "mypassword" ssh mylogin@myhost

Tried with: sshpass 1.05 and Ubuntu 12.04 LTS

How to use Mercurial Keyring extension with TortoiseHg

With Mercurial, you need to enter your password every time you clone, push or pull from a private remote repository (like at BitBucket for example). The Mercurial Keyring extension eliminates the need to enter your password for every single operation. Using it with TortoiseHg to clone, push or pull is really easy.

  1. Enable the Mercurial Keyring extension. Right-click anywhere in Windows Explorer and choose TortoiseHg → Global Settings → Extensions. Enable mercurial_keyring.
  2. Close all open windows of TortoiseHg.
  3. The next time you clone or push or pull with a remote repository, TortoiseHg will prompt for your password. Enter it.
  4. After that one time, TortoiseHg will not ask your password again. Push and pull to your heart’s content 🙂

Tried with: TortoiseHg 2.4.1 and Windows 7 Professional x64

PDFTK: Owner password required error


You try to manipulate some PDF files using PDFTK and it gives the following error:

Error: Failed to open PDF file:
   OWNER PASSWORD REQUIRED, but not given (or incorrect)


The PDF files for which PDFTK prints this error might be password protected or encrypted. If you can open and view the PDF file using any PDF viewer then it might mean that the PDF files are protected or encrypted with an empty password.

To be able to apply PDFTK on these files, you will need to remove the protection or decrypt the files. One way to do this is using the QPDF tool.

Tried with: PDFTK 1.44

SuperGenPass extension for Chrome


The websites we use do not guard our passwords securely. So, it is good practice to use a different password for each website. But, it is truly impractical to remember that many passwords. So, the solution is to use a password generator. It typically uses a master password to generate custom passwords for each domain. So, even if the password at one of your websites is compromised, that password is useless for the thief since he cannot use it anywhere else.

The password generator that I have started to use is SuperGenPass. Given a master password, it uses that to generate a custom password for every domain that you login to. It is available as an extension for Chrome here.


Using it is simple. Head over to Extensions, find SuperGenPass for Google Chrome and choose Options. Type in a master password, choose a length (typically 10) and give this password profile a nickname. It will be assigned a digit. For example, the first one you create will be 1.

Now whenever you open a login webpage on any website, SuperGenPass is activated. When you switch to the password field, SuperGenPass will show you the master passwords available and their digits. Type the digit and SuperGenPass will fill in the custom password it generated using that master password and the domain of the website.

The first time you change your password on a website from your old one to one that is generated by SuperGenPass, you will need to use the above procedure.

Tried with: SuperGenPass for Google Chrome 5.0 and Google Chrome 20.0.1132.47