Read more

Generate a strong secret from the shell

Henning Koch
September 30, 2010Software engineer at makandra GmbH

A good tool to generate strong passwords and secrets is "apg". You can get it with

sudo apt-get install apg
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

To create a strong secret for sessions, hashed Paperclip paths, etc. say

apg -m128 -a1 -E\'\"

Arguments explained:

  • The -m parameter defines the secret length
  • -a1 makes apg choose from all 7-bit ASCII characters instead of just the alphabet
  • -E\'\" excludes quote characters so you can easily paste the secret into a Ruby string
Posted by Henning Koch to makandra dev (2010-09-30 14:28)