LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   generate strong passwd w/ openssl bash alias and copy directly to clipboard (http://www.linuxquestions.org/questions/linux-newbie-8/generate-strong-passwd-w-openssl-bash-alias-and-copy-directly-to-clipboard-904655/)

dchol 09-23-2011 12:50 PM

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
Code:

openssl rand -base64 16
directly to clipboard.

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

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:

Code:

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.

thx

dchol 09-24-2011 02:04 AM

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

Code:

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



All times are GMT -5. The time now is 09:10 PM.