Operating System - HP-UX
1825882 Members
2853 Online
109689 Solutions
New Discussion

Help needed with batch password script - urgent(!)

 
SOLVED
Go to solution
Simon R Wootton
Regular Advisor

Help needed with batch password script - urgent(!)

Hi All

We use a script called 'batchpw' which allows us to add users to the system in batches. Since last week, this script has started to fail and yet we're not aware of anything changing.

I have attached a screen shot of the error(s) when the script is run and also the script itself.

If anyone can solve this, there's 10 points waiting !!

Regards
Simon

RP7410 running HPUX11i
6 REPLIES 6
Aneesh Mohan
Honored Contributor

Re: Help needed with batch password script - urgent(!)


Hi Simon,

It seems the account which is propagating/creating the new users is not valid .If you could post the script it will be better to diagnoise the problem.


Aneesh
Aneesh Mohan
Honored Contributor

Re: Help needed with batch password script - urgent(!)

Hi Simon,

One correction to the above reply (becoz I couldn`t get the screen properly at first time)

The error is because you are not specifying the userid for creating the user,that could be the reason it is not creating new user.

Aneesh
Laurent Menase
Honored Contributor

Re: Help needed with batch password script - urgent(!)

Why don't you do just:


max=$(cut -d : -f 3
Laurent Menase
Honored Contributor

Re: Help needed with batch password script - urgent(!)

or
findmaxuid()
{
cut -d : -f 3 }

((newuid=$(findmaxuid)+1))
Matti_Kurkela
Honored Contributor
Solution

Re: Help needed with batch password script - urgent(!)

Hmm, the error messages indicate trouble at lines 4 and 137 of the script. Since you've copy-pasted the script into a MSWord document and it has a blank line between each line of the script, it is hard to find the correct line. An screenshot and the script enclosed in a .zip file would have been much better... but I digress.

The errors seem to indicate problems with parsing the existing contents of the password file. There might be a malformed line in the /etc/passwd file.

Please run "pwck". Some "Login directory not found" errors from system directories are normal, but any other errors might indicate trouble.

By the way, your script is changing /etc/passwd without using the standard lock /etc/ptmp. This is asking for trouble.

Your script should create /etc/ptmp as it starts and remove it after it has appended the new users to the /etc/passwd file. This would ensure that no other tools will modify /etc/passwd while the critical part of the script is running.

MK
MK
Simon R Wootton
Regular Advisor

Re: Help needed with batch password script - urgent(!)

Running 'pwck' did it - we had a user incorrectly setup and I removed it. All looks well. Thanks to all.