custom command useradd

6 posts / 0 new
Last post
#1 Fri, 05/01/2009 - 03:25
operweb

custom command useradd

hi i want to add a custom command "name:custcmd" that run an sh command or script useradd -g 509 -u 510 -p password -o -d /home/user/www/subuser -s /bin/false subuser

to virtualmin with some variable but i dont know how to do i want to add this command like that useradd -g {$gid} -u {$uid} -p {$password} -o -d /home/{$user}/www/{$subuser} -s /bin/false {$subuser}

and i want to get this custom command on remote like this

virtual-server/remote.cgi?program=custcmd&user=nameuser&subuser=subuser&pass=password&uid=uid&gid=gid

i this i must buidl an command on virtual-server with perl script to get this

thanks and sorry for my english

Mon, 05/04/2009 - 14:01
mrwilder

That'd be relatively trivial in php or c, but it's been so long since I've done anything in perl, I wouldn't want to embarrass myself and waste your time.

If you want me to post some c code or php code, I'd try to help you with that.

Sun, 06/07/2009 - 07:53 (Reply to #2)
operweb

[code:1]system("/usr/sbin/adduser -g $gid -u $uid -p $pass -o -d $dir -s /bin/false $user \n"«»);[/code:1]

Thu, 05/07/2009 - 11:01 (Reply to #3)
operweb

how to encrypt password on useradd or adduser command
thanks

Mon, 05/04/2009 - 15:19
mrwilder

To put it into perspective how long it's been... did perl ever get some standard library to parse cgi arguments?

hehe...

or do you still have to roll your own to get that $gid and $uid out?

Mon, 05/04/2009 - 15:27 (Reply to #5)
andreychek

<div class='quote'>To put it into perspective how long it's been... did perl ever get some standard library to parse cgi arguments?</div>

Heh :-)

Yeah, they solved that problem.

There's a lib called, well, CGI:

http://search.cpan.org/~lds/CGI.pm-3.43/CGI.pm

Essentially, you'd use something like this:

[code:1]
use CGI();

# Instantiate the CGI Object
my $q = CGI-&gt;new;

# Retrieve the value of the 'uid' CGI parameter
my $uid = $q-&gt;param('uid');
[/code:1]

Topic locked