1752802 Members
5666 Online
108789 Solutions
New Discussion юеВ

Re: Automation

 
Horia Chirculescu
Honored Contributor

Re: Automation

Pls read "to run useradd and "

as

"to run useradd and any other commands you need"
Best regards from Romania,
Horia.
Spark_2
Frequent Advisor

Re: Automation

Thank you for continous help.It seems you missed some part of my previous post. Please go through again and suggest
Horia Chirculescu
Honored Contributor

Re: Automation

> are fine but as soon as 'sudo useradd..' comes permission denied is being prompted.

Let's say:

which useradd
/usr/sbin/useradd

In this case you did something wrong when configure sudo. Review your sudoers (edit the sudoers file only with visudo command!)

Cmnd_Alias PRIV_CMDS = /usr/sbin/useradd, /path_to_yourscript/yourscript

maintenance ALL= NOPASSWD: PRIV_CMDS

Save the file sing :wq command

You can also specify /usr/sbin/ and all your executables from /usr/sbin will be executed by maintenance user.

This should do the job.

Best regards
Horia.
Best regards from Romania,
Horia.
Robert Salter
Respected Contributor

Re: Automation

If you have your ssh public keys set up on all of your servers you can use 'ssh' to execute your remote commands without logging in directly. Then you can write your scripts to perform the work you want from on server, i.e. useradd, etc. Just maek sure to use the full path to the commands in your scripts.

Beers,

robert
Time to smoke and joke
melvyn burnard
Honored Contributor

Re: Automation

Have you taken a look at DSAU? (Distributed Systems Administration Utilites).
It is designed to "fan out" commands to a number of servers.
http://docs.hp.com/en/T2786-90327/T2786-90327.pdf
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Nido
Trusted Contributor

Re: Automation

Hi & How are you?

Playing with SSH and SUDO would require you to log into each system and have setup.

I will need to check "Distributed Systems Administration Utilities"

How about a dirty way of using expect.
Write some 10-15 liners by putting conditions in expect program ( you may switch to uid 0 later within expect program and thats what your system expects to NOT login as uid 0).

Put expect on either HPUX box or find expect in any redhat.

http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/

p.s. No points for a dirty way.

Chocolates?

Cheers!!
" Let Villagers Be Happy!! "
D. Jackson_1
Honored Contributor

Re: Automation

Can you please provide examples of what you are trying to get done.
SSH access with a sudo implementation will work. Just take some scripting to do it.