LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-23-2011, 12:50 PM   #1
dchol
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
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
 
Old 09-24-2011, 02:04 AM   #2
dchol
LQ Newbie
 
Registered: Jul 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
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'
 
  


Reply

Tags
bash scripting, openssl, terminal



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 3 04-18-2019 05:51 PM
[SOLVED] How to copy to clipboard using bash command? Mr. Alex Linux - Newbie 5 09-18-2010 11:46 AM
OpenSSL generate cert error funkflex2004 Linux - Server 1 11-12-2009 01:02 PM
OpenSSL: generate Intermediate CA? new_to_open_ssl Linux - Security 15 01-24-2006 07:29 AM
Using OpenSSL to generate certificates 24jedi Linux - Software 5 09-10-2005 12:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:56 PM.

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