Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2005-04-06
Medium Priority
Last Modified: 2010-04-21

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.

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");


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

Question by:jeffparis
  • 3
  • 2
LVL 15

Accepted Solution

mish33 earned 2000 total points
ID: 13738392
So your ssh... command working from root. Great! That is step 1.

Step 2: you're trying to run it not as root but as apache.
So temporarily change the line in /etc/passwd


so that you can test out apache access to the ssh...

NOTE !!! only change the following for testing purposes so that you can su to apache from root and test it.

# su - apache
$ ssh...
and make sure it works (you will need to setup all keys and other jazz).

Step 3: Roll back /etc/passwd and try <?php exec('ssh...') ?> again. It shall work now.

In any case it's a huge security risk and you are on your own etc. etc.

BTW, first, you use -mailbox true twice and second, better add -qn to ssh (like ssh -qn -i...) to silence it and disable stdin reading.

Author Comment

ID: 13739178
Dude, that rocks, i will test it later tonight and if it works, i will give you the points with an A!

Author Comment

ID: 13739815
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!

Author Comment

ID: 13739973
Soemthing like this would be easier, right?

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');

LVL 15

Expert Comment

ID: 13740150
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.

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month21 days, 4 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question