Current time: 11-16-2024, 07:12 AM Hello There, Guest! (LoginRegister)


Post Reply 
Remote useradd mod
Author Message
robmorin Offline
Junior Member
*

Posts: 208
Joined: Apr 2007
Reputation: 0
Post: #1
Remote useradd mod
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..
10-18-2007 04:26 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #2
RE: Remote useradd mod
have a look at the perl files in the "engine" folder.
Especially the ispcp_common_methods.pl, the sub
"add_dmn_suexec_user"...

/Joximu
10-18-2007 06:20 AM
Visit this user's website Find all posts by this user Quote this message in a reply
robmorin Offline
Junior Member
*

Posts: 208
Joined: Apr 2007
Reputation: 0
Post: #3
RE: Remote useradd mod
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
10-19-2007 04:46 AM
Find all posts by this user Quote this message in a reply
robmorin Offline
Junior Member
*

Posts: 208
Joined: Apr 2007
Reputation: 0
Post: #4
RE: Remote useradd mod
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
10-19-2007 05:36 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #5
RE: Remote useradd mod
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
10-19-2007 06:09 AM
Visit this user's website Find all posts by this user Quote this message in a reply
robmorin Offline
Junior Member
*

Posts: 208
Joined: Apr 2007
Reputation: 0
Post: #6
RE: Remote useradd mod
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
10-19-2007 06:50 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #7
RE: Remote useradd mod
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
10-19-2007 07:08 AM
Visit this user's website Find all posts by this user Quote this message in a reply
robmorin Offline
Junior Member
*

Posts: 208
Joined: Apr 2007
Reputation: 0
Post: #8
RE: Remote useradd mod
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
10-19-2007 11:15 PM
Find all posts by this user Quote this message in a reply
rbtux Offline
Moderator
*****
Moderators

Posts: 1,847
Joined: Feb 2007
Reputation: 33
Post: #9
RE: Remote useradd mod
omit the -g option and the group according to the username is automatically created...
10-19-2007 11:28 PM
Visit this user's website Find all posts by this user Quote this message in a reply
robmorin Offline
Junior Member
*

Posts: 208
Joined: Apr 2007
Reputation: 0
Post: #10
RE: Remote useradd mod
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...
10-20-2007 12:06 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)