Mike Garcia

until your eyes bleed

12. June 2015 397 words ~3 minutes read Comment

Generate a Diceware Password & Copy to Clipboard – Linux

generating diceware passwords


After discovering what diceware passwords are (from these articles [1] & [2]), I decided to quickly switch to these passwords for my day to day. A couple of things I like about diceware, is that I find myself giving people complicated passwords pretty often. Nothing sucks more than repeating “X1l2#!8^*&#();3k’/;l[]” ten times to someone who doesn’t know why using “pass123” is not good enough. Another thing is ease of typing a password in manually. I use lastpass and sometimes I am forced to actually type a password in (vs. copy/paste) and diceware passwords are much easier. Anyways those a just a few reasons.

So, how do I make it dead simple to generate a diceware password whenever I need one?

Well luckily I found this dude’s github repo that did a little python script to generate them. So with a little tweaking and some bashrc handywork, I was able to simplify the process into just typing “pw” into the terminal and have it generate & copy a diceware password to the clipboard for my immediate use, easy right?

Here’s How (for reference I’m using Linux Mint 17.1 x64):

1. Open terminal, make sure you have “xsel” installed, it’s used to copy the diceware pw to the clipboard, type sudo apt-get install xsel

2. In terminal, navigate to your git folder or just use your home folder and type

git clone

3. In terminal, open the cloned folder by typing cd diceware

4. Run this command, to correct permissions chmod u+x diceware-v2

5. Open your .bashrc file in your home directory, by navigating to home directory and showing hidden files. Open your .bashrc file in whatever text editor you like, and paste this at the very bottom alias pw=’~/git/diceware/diceware-v2 -w 4 | xsel -i -b’

(if you don’t already have a .bashrc file in the home directory, you can create one here)

6. Save and close everything. Now open a new terminal window, type pw and then Ctrl+V into a text editor to test that it’s generating 5 part diceware passwords.

Now whenever you need a new password for anything, it’s as simple as running “pw” in terminal and pasting!

Leave a Reply