ispCP - Board - Support
Remote useradd mod - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: System Setup & Installation (/forum-32.html)
+--- Thread: Remote useradd mod (/thread-1560.html)

Pages: 1 2


Remote useradd mod - robmorin - 10-18-2007 04:26 AM

Hello all i was wondering what would be the best method to have Omega add whatever vu20xx user it is adding to /etc/passwd file also add it to a remote machine? I mean a simple ssh command to another machine would be easy, but how would i tell Omega to do this, so that i would have 2 machine with the same users in the password ?

Thanks to all in advance!

Have a great day

Rob..


RE: Remote useradd mod - joximu - 10-18-2007 06:20 AM

have a look at the perl files in the "engine" folder.
Especially the ispcp_common_methods.pl, the sub
"add_dmn_suexec_user"...

/Joximu


RE: Remote useradd mod - robmorin - 10-19-2007 04:46 AM

Thanks i will check that right away...

Have a good one!
Rob..


joximu Wrote:have a look at the perl files in the "engine" folder.
Especially the ispcp_common_methods.pl, the sub
"add_dmn_suexec_user"...

/Joximu



RE: Remote useradd mod - robmorin - 10-19-2007 05:36 AM

Ok so i added this

my $cmdR = "ssh -l root peter.domain.com /usr/sbin/useradd $sys_uid $sys_user";

and then this
sys_command($cmdR);

And it does not work, now if i hard code the user in like so....

my $cmdR = "ssh -l root peter.domain.com /usr/sbin/useradd fred";

t works, i did that just to make sure communication works ok between the servers... so i guess its not getting the variables right somehow... I am not a perl person at all.... so ay help appreciated

Thanks
Rob..


robmorin Wrote:Thanks i will check that right away...

Have a good one!
Rob..


joximu Wrote:have a look at the perl files in the "engine" folder.
Especially the ispcp_common_methods.pl, the sub
"add_dmn_suexec_user"...

/Joximu



RE: Remote useradd mod - joximu - 10-19-2007 06:09 AM

Is there anything in the logfile on the remote machine?

I'd try:
Code:
my $cmdR = "ssh -l root peter.domain.com /usr/sbin/useradd -u $sys_uid $sys_user";

maybe also an "-m" to create the home, and maybe also the homedir ( -d home ) - it depends on what you want to do...

/J


RE: Remote useradd mod - robmorin - 10-19-2007 06:50 AM

Yes i tried the actuall whole line but no go, thats why i tried a simple static entry like fred as the username, and it worked, so it does connect to the machine and does stuff , but i think the useradd fails because of a syntax error, with respect to the variables.....

Nothing on the remote machine in the logs pertaining to a bad useradd command..

Anything else i should check?

Thanks
Rob..



joximu Wrote:Is there anything in the logfile on the remote machine?

I'd try:
Code:
my $cmdR = "ssh -l root peter.domain.com /usr/sbin/useradd -u $sys_uid $sys_user";

maybe also an "-m" to create the home, and maybe also the homedir ( -d home ) - it depends on what you want to do...

/J



RE: Remote useradd mod - joximu - 10-19-2007 07:08 AM

did you add the "-u"

useradd -u uid login

and not

useradd uid login

maybe you cann add a

> /tmp/my-test.log 2>&1

or similar - hopefully you see whats wrong...

/J


RE: Remote useradd mod - robmorin - 10-19-2007 11:15 PM

Cool.. ok so i added the -u and my test worked , however when i addded back all the other arguments it did not work, and this was in the log

joe:/var/www/ispcp/engine# cat /tmp/my-test.log
useradd: unknown group vu2013

weird how it does not get the group, unless the group needs to be added firstly?

the whole line is...
my $cmdR = "ssh -l root peter.domain.com /usr/sbin/useradd -c virtual-user -d $homedir -g $sys_group -s /bin/false -u $sys_uid $sys_user";

Thanks for your help!

Rob...

joximu Wrote:did you add the "-u"

useradd -u uid login

and not

useradd uid login

maybe you cann add a

> /tmp/my-test.log 2>&1

or similar - hopefully you see whats wrong...

/J



RE: Remote useradd mod - rbtux - 10-19-2007 11:28 PM

omit the -g option and the group according to the username is automatically created...


RE: Remote useradd mod - robmorin - 10-20-2007 12:06 AM

OK i do this and all is fine, even the userdel & groupdel works fine!

i am happing now Smile

my $cmd_ARG = "ssh -l root peter.domain.com /usr/sbin/groupadd -g $sys_gid $sys_group";
my $cmd_ARU = "ssh -l root peter.domain.com /usr/sbin/useradd -c virtual-user -d $homedir -g $sys_group -s /bin/false -u $sys_uid $sys_user

Thanks for your help!

I hope other will use this if they are using multiple web servers! Someone make this thread a Stick!, or in the FAQ or ho to section

Have a nice day everyone!

Rob..
Montreal, Canada
rbtux Wrote:omit the -g option and the group according to the username is automatically created...