Random password generation


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Operating Systems AIX Random password generation
# 1  
Random password generation

Hello,

I have created a script to generate a random password on Linux/Solaris, but I simply cannot use it on my AIX VMs since Bash isn't installed on them.

I need a password that is randomly created with the following characters:
Code:
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@;:[].{}+=<>#|()^&_0123456789

And that's where the problem is.. those special characters are excluded from commands such as makekey.

Here's what I've done for Linux:
Code:
MATRICE="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@;:[].{}+=<>#|()^&_0123456789"
n=1
PASSWD=""
while [ "$n" -le 7]
do
  PASSWD="$PASSWD${MATRICE:$(($RANDOM%${#MATRICE})):1}"
  let n+=1
done

Any ideas how I can generate a random password that doesn't require bash installed, and that takes into account all the special characters?

Thanks!

Last edited by rbatte1; 09-08-2014 at 12:39 PM..
# 2  
What AIX version is that?
# 3  
Basically it's for: 5.2, 5.3, 6.1 & 7.1 (around 50 VMs).
# 4  
6.1 and 7.1 have bash... I dont know for 5.2, 5.3

#--
Seems 5.3 also (well here I found a 5.3 box that has bash mans and the shell...

Last edited by vbe; 09-04-2014 at 10:47 AM.. Reason: addendum for 5.3
# 5  
Do you accept a Perl solution? Smilie
# 6  
I did the following on all the previously listed versions and could not find bash:
Code:
lslpp -l | grep bash*

But I suppose another option would be to deploy bash on all those machines, and then the script would work fine Smilie

As for Perl, none of the admins here use it, and I for one don't know the first thing about it :/
# 7  
That said I avoid special characters because they can play dirty tricks depending how you connect.. But it doesnt seem to affect you since it works under LINUX... (typically when using X software emulation from PCs... )
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #555
Difficulty: Easy
In C, if double b = 3.14159265359; printf("b=%10f ", b); then the output with be b=3.141593
True or False?

10 More Discussions You Might Find Interesting

1. Ubuntu

Random insertion of letters to password

Hi,, Here i have attached a text file where iam facing problem in my code. Please read the file and help me out of this issue.. Thanks in advance (4 Replies)
Discussion started by: vanid
4 Replies

2. Ubuntu

expect script for random password and random commands

Hi I am new to expect. Please if any one can help on my issue its really appreciable. here is my issue: I want expect script for random passwords and random commands generation. please can anyone help me? Many Thanks in advance (0 Replies)
Discussion started by: vanid
0 Replies

3. Shell Programming and Scripting

Random word generation with AWK

Hi - I have a word GTTCAGAGTTCTACAGTCCGACGAT I need to extract all the possible "chunks" of 7 or above letter "words" from this. SO, my out put should be GTTCAGA TTCAGAG TCAGAGT CAGAGTTCT TCCGACGAT CAGTCCGACG etc. How can I do that with awk or any other language? I have no... (2 Replies)
Discussion started by: polsum
2 Replies

4. Shell Programming and Scripting

random number generation in ksh

i tried to use $random function in unix i simply typed print $random at shell and it returnted no value is there any function in korn shell that i can use to generate random number help is appreciated (2 Replies)
Discussion started by: er_zeeshan05
2 Replies

5. Shell Programming and Scripting

Random NUmbers Generation with out repetation

Hi I have the below code MAXCOUNT=10 count=1 echo echo "$MAXCOUNT random numbers:" echo "-----------------" while # Generate 10 ($MAXCOUNT) random integers. do number=$ + 1 ] "echo $number" let "count += 1" # Increment count. done But aftre executing this ... (8 Replies)
Discussion started by: lalitka
8 Replies

6. UNIX and Linux Applications

SSH: Avoiding password prompt with rsa key generation

Hi, I am using a remote storage service for backing up our data - we want to have a script run as part of a cron job which would do the backups from our local Linux machine to the service's Linux machine. I want to use tar and ssh to do this (rather than mounting the disk and using cp) .... (5 Replies)
Discussion started by: same1290
5 Replies

7. Programming

Generate Random Password in C

I need a function to generate a random alphanumeric password in C code. It needs to be between 6-8 characters and follow the following rules: Reject if same char appears # time: 4 or more Reject if same char appears consecutively: 3 or more I have the following random password working for... (2 Replies)
Discussion started by: vjaws
2 Replies

8. Shell Programming and Scripting

Generate a random password

Hello All... Can someone help me generate a random password which will be 7 characters long which contains alpha-numeric characters using shell script. I am looking to store the output of the script that generates the password to a variable within a script and use it as the password. ... (5 Replies)
Discussion started by: chiru_h
5 Replies

9. UNIX for Dummies Questions & Answers

Random number generation in ksh

I need to generate a random number in ksh everytime I run the script ,the range should be from 100 to 24800,I could use $RANDOM but I seem to have no control over the range of numbers ,could you please suggest some way I could implement this .Thanks. Mervin (2 Replies)
Discussion started by: mervin2006
2 Replies

10. Programming

Random number generation

Hi...How can I generate random numbers between a given range ...preferably between 1 and 100...in UNIX C programming...? I tried out functions like rand(),drand48() etc but didnt get satisfactory results... Thanks a lot in advance.......... (1 Reply)
Discussion started by: tej.buch
1 Replies

Featured Tech Videos