Link to home
Start Free TrialLog in
Avatar of jeffparis
jeffparis

asked on

Email creation Integration with PLESK 7.5 Reloaded on Red Hat (php 4.* and MySQL 4.*)





I am trying to write a function to allow users to have an email account created in PLESK 7.5 Reloaded when they register with one of my websites. However, I can not get this very important line to work. Any help would be appreciated.  I set up the public keys and all that jazz, but it just won't work. PHP isn't in safe mode. I have tried system() exec() shell_exec() and passthrough(), no go.  I know it is possible, though.  I don't care how I get this working, whether with a shell script or php, but I need to get it to work. I am not sure if I can give more than 500 points, but I wish to give a 1000 points if possible.

Here is what I tried, works only from command line when logged in as root, need to send the command as root, but through a browser without giving others root access, of course.


<?php
shell_exec("ssh root@ns3.domain.com -i /root/.ssh/id_rsa /usr/local/psa/bin/mail.sh --create testing19@domain.com -mailbox true -cp_access true -mailbox true -passwd PASSWORDHERE \n");
?>


AND TRIED VARIATIONS OF:


<?php
exec("/usr/local/psa/bin/mail.sh --create testing19@domain.com -mailbox true -cp_access true -mailbox true -passwd PASSWORDHERE");
?>




Here is the command that needs to execute whena  user registers. I left the username and password variables out for testing purposes.

/usr/local/psa/bin/mail.sh --create testing19@domain.com -mailbox true -cp_access true -mailbox true -passwd PASSWORDHERE




Documentation: http://download1.sw-soft.com/Plesk/Plesk7.5/Doc/plesk-7.5r-sdk-html/docs/cu/unix/ch14.html

It eventually does TRY TO work, it seems that the page hangs and the email is not created. I think that it is a security thing keeping it from executing, but I am not sure. If anyone is a Plesk expert, I could really use assistance ont his one:)




Email: dude (A) freeonlineblogs.com


ASKER CERTIFIED SOLUTION
Avatar of mish33
mish33
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jeffparis
jeffparis

ASKER

Dude, that rocks, i will test it later tonight and if it works, i will give you the points with an A!
Ok, this rocks, however, it is asking for root's password. I will see if I can get around this. If you know how, I'd appreciate the advice.

Thanks for the help!
Soemthing like this would be easier, right?

<?php
shell_exec('env -i htpasswd -n -b -m root ROOTPASSWORD \n /usr/local/psa/bin/mail.sh -c XXXXXX@XXXXXXXXXXXX.com --mailbox true -passwd XXXXXX \n');

?>
If you web server is on ns3 you don't need to ssh to it and you can go with sudo command.
If not, you need to ssh to ns3 machine from web server machine and you need to setup public and private keys.