These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for custom command useradd on the new forum.
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
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.
[code:1]system("/usr/sbin/adduser -g $gid -u $uid -p $pass -o -d $dir -s /bin/false $user \n"«»);[/code:1]
how to encrypt password on useradd or adduser command
thanks
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?
<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->new;
# Retrieve the value of the 'uid' CGI parameter
my $uid = $q->param('uid');
[/code:1]