Quote:
Originally Posted by
VenkatPVS
Please post if any having a working script?
Sorry, but this is not how it works:
you will write your script! And while we will assist you, explain things to you, correct your code if necessary and help you in any possible way - we will not write it for you.
Quote:
Originally Posted by
VenkatPVS
Am very new to shell scripting and would need help on a script that needs to be executed on a central server which takes IP, Flavor (AIX, Solaris, RHEL) as inputs and create a new account/user, update the existing users settings, delete or disable the users/accounts in those servers (AIX, Solaris, RHEL).
OK, two things: first a question. There are generalised user-directory services which could be used for that: LDAP, NIS, DCE, ... Why don't you use one of these? All the mentioned UNIX/Linux flavours could be brought to cooperate with these services and you would not even have to create or maintain local users.
Second, reagrding the script itself: it is possible to do this and in fact i have done so. Notice that - to do it right - this is an effort worth several thousand lines of code. Not even an expert in scripting will be able to do it in some spare minutes to kill. This is a regular software engineering project and you should treat it that way from the start. This means before you can write even one line of code you need a thorough plan, you need to have thought things through and you need to have a detailed and concise idea of what you are going to do - "manage users on many systems" is like "i want to design a car". As long as you do not know how motors, gearboxes, brakes, etc. work this will not succeed.
OK, let us start by planning some basics. Every user is identified by a user name and a (unique) ID. Usually you find both informations in a file called
/etc/passwd. You might want to start by not creating a user account but a script (function) that just checks if a user exists already.
Now think about what could come out for such a check. Here are some sample conditions, you might find more:
- the file
/etc/password doesn't exist or isn't readable
- the user name exists in an account, but with another UID
- the user ID exists in an account, but with another name
- both user name and ID exist, but in different users
- the user name exists and has the correct ID (-> this is the "success" case)
All these (and probably more, be creative) conditions will have to be checked and reported (to an eventual calling program) by the check-function/-script.
You should have an idea now of what it takes to do what you want and start the design process.
I hope this helps.
bakunin