Random password generation


 
Thread Tools Search this Thread
Operating Systems AIX Random password generation
# 8  
Old 09-04-2014
I don't really have a choice here, I have to follow what the security team decides, and they want special characters in the passwords --'
# 9  
Old 09-04-2014
Quote:
Originally Posted by gfroute
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:
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!
I was surprised that this worked with bash; there should be a space between the 7 and the ] in the line marked in red above. If you add a space there, this script will also work with ksh93. Is ksh93 available on the older AIX releases?
# 10  
Old 09-08-2014
Could I suggest that @ & # are excluded?

Some OS versions treat these strangley, e.g @ as end of password. We now advise all users to avoid them along with the pound sign £ because that can be translated to # and therefore cause problems. Perhaps other currency symbols have the same risks.




Robin
# 11  
Old 09-08-2014
That was what I was talking about Robin... haha you worked with HP...
And my point of vue is that here we use the country's keyboard layout, but how many time I got caught when in computer room I had in front of me a qwerty US keyboard... and having to desperatly try to guess where thos *** of char are hidden - and worse typing without being able to see the output, not mentionning the HP that with 3 bad passwd lock the accounts ( I corrected that later because it was just a nightmare...)
I still sometimes cant connect to some hosts because of locale issues with passwords that is why I tend to say yes all the chars but only those that are the same in ALL CHARSET and forget about the others for root...
# 12  
Old 09-08-2014
Yes! Smilie

To my shame I have two HP-UX 11.11 servers Smilie The hardware is about 12 years old and inherited from a merger where in their wisdom, all the tech support of the other side were let go before we'd even logged on. We had to learn bdf rather than df and daft things like that. Well, it's helped keep me employed for a few years..... maybe until mid-next year anyway.



Robin
# 13  
Old 09-08-2014
Quote:
Originally Posted by rbatte1
We had to learn bdf rather than df and daft things like that.
Well, i suggest you ask Sam. ;-))

Regarding the problem at hand:

A ksh93 is provided in standard AIX as /usr/bin/ksh93 since either 5.1 or 5.2, i can't remember which.

If you want a bash You can download it freely from either Michael Perzls site (which i can wholeheartedly recommend - his efforts put IBMs "Linux Affinity" program to shame singlehandedly) or from IBMs "AIX Toolbox for Linux" page or even from Bulls "Freeware for AIX" page.

Btw., the bash package is called "freeware.bash.<something>" and it is an rpm package, so searching for "bash*" will not yield any results, even if it is installed. Search for "freeware.*" instead.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

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
Login or Register to Ask a Question