Operating System - HP-UX
1830939 Members
1714 Online
110017 Solutions
New Discussion

Re: script to generate a password

 
SOLVED
Go to solution
Doug_3
Frequent Advisor

script to generate a password

Hi all,

The ops mgr wants to alter an outside vendor's password each day. I could not find anything canned and don't really want to roll my own. It would need to generate a new password and email the operators the new password.

Any scripts out there? We are on 11.00 untrusted system.

If there is nothing ready to use ideas on how to generate that password?

Thanks in advance,
Doug

8 REPLIES 8
Pete Randall
Outstanding Contributor
Solution

Re: script to generate a password

Doug,

Attached is a rather ugly, very homegrown script to generate a four character password, all alpha. You could adapt it to whatever lenght you need.


Pete

Pete
Darren Prior
Honored Contributor

Re: script to generate a password

Hi Doug,

You might be introducing a bit of a security hole if you are emailing plaintext passwords from the server...

Perhaps the vendor could supply you with a list of a month's worth of pre-encrypted passwords; then you could have a cron job that moves the pre-encrypted passwords into place?

regards,

Darren.
Calm down. It's only ones and zeros...
Doug_3
Frequent Advisor

Re: script to generate a password

Thanks Darren, Pete. The script will work fine!

There should be no security hole as I am not sending them out of the server, just to the operator account avail in the server.

Thanks Again to you both.

Doug
Geoff Wild
Honored Contributor

Re: script to generate a password

Here's a good one in C.

Generates a random password - very hard to crack - will pass just about any security audit...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
John Poff
Honored Contributor

Re: script to generate a password

Hi,

Here is a little Perl script I use to generate 'ugly' passwords that make our security guy happy:

#!/usr/bin/perl

# ugly_password.pl

# This script will generate a random password 16 characters long using
# upper and lower case alphabetical characters, numbers, and special
# characters.


@chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ # $ % ^ & _ - [ ] { }) );
$password = join("", @chars[ map { rand @chars } ( 1 .. 16 ) ]);

print "New password is $password\n";


JP

P.S. Merijn should be happy. I actually do a little bit of scripting [not enough] in Perl. ;)
Dave La Mar
Honored Contributor

Re: script to generate a password

For Geoff -
Hope you return to this thread.
I've tried your cprog but < > are still generated. I've tried quoting and double quoting in the define but they are still generated. ???

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Geoff Wild
Honored Contributor

Re: script to generate a password

Dave,

Strange = the c program was developed on a Solaris box - I've tried compiling on HPUX 11.11 - to no avail - on Solaris those characters never show up in random passwords - how did you complie on HP?

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Dave La Mar
Honored Contributor

Re: script to generate a password

Geoff -
Man, I had forgotten about this note.
Anyway, it was using ANSI C on HP-UX 11.0
Thanks for the follow up.

dl
"I'm not dumb. I just have a command of thoroughly useless information."