Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-23-2011, 01:50 PM   #1
LQ Newbie
Registered: Jul 2011
Posts: 10

Rep: Reputation: Disabled
generate strong passwd w/ openssl bash alias and copy directly to clipboard

i'd like to generate strong passwords from terminal using a bash alias for "openssl" which copies the results of
openssl rand -base64 16
directly to clipboard.

i've tried many derivations of the below alias but haven't yet "cracked the code":

(from .bash_aliases)

alias pass-gen='openssl rand -base64 ........
so far the only output i've received after modifying the above alias with different combinations of pipes and "pbcopy" is this:

Usage: rand [options] num
where options are
-out file             - write to file
-engine e             - use engine e, possibly a hardware device.
-rand file:file:... - seed PRNG from files
-base64               - base64 encode output
-hex                  - hex encode output

any advice/hints would be greatly appreciated.

Old 09-24-2011, 03:04 AM   #2
LQ Newbie
Registered: Jul 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled

ok in case anyone else ever wonders how to do this, here's something i wrote that works:

# shortcut to generate strong password using openssl
alias pass-gen='openssl rand -base64 12 | while read passwd; do echo $passwd | pbcopy; done'


bash scripting, openssl, terminal

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
why can't i generate a new certificate with openssl? achouramira Linux - Security 2 01-04-2018 03:01 PM
[SOLVED] How to copy to clipboard using bash command? Mr. Alex Linux - Newbie 5 09-18-2010 12:46 PM
OpenSSL generate cert error funkflex2004 Linux - Server 1 11-12-2009 02:02 PM
OpenSSL: generate Intermediate CA? new_to_open_ssl Linux - Security 15 01-24-2006 08:29 AM
Using OpenSSL to generate certificates 24jedi Linux - Software 5 09-10-2005 01:01 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration