[one-users] Execute 'oneuser create username password' from PHP through shell_exec ?

Anders Branderud anders.branderud at gmail.com
Fri Jun 17 09:25:54 PDT 2011


Hello again!

Included in my thesis is to create an administration interface, in which an
administrator can approve users whom have asked for access to use
OpenNebula.

Upon approval the users should be added to OpenNebula (i.e. it corresponds
to the command 'oneadmin createuser username password'). [More information
of the interface:
Link<https://docs.google.com/document/d/1YyW0z1wkS0LuRXyBNMrtUf2UNGtszYz8t8PALhV7Msc/edit?hl=en_US>
(section
4.2)]

I am trying to perform this with an execution of a shell command in a
php-file.

Why doesn't this work (below is just a specific example - not the general
code that I am using)?

$execQuery = "/bin/su oneadmin postgres -c 'oneuser create test10 test10'";
shell_exec ($execQuery); //execute query in shell.

Neither does this work (despite that I am logged in as oneadmin, when the
script is executed by PHP):
shell_exec ("oneuser create test10 test10");

It works when I type that command in the shell.
I have tried to execute other shell commands through php and those work
fine, so I wonder where the problem lies.

Thanks!

-- Kind regards, Anders Branderud
[Personal blog] Will of the
Creator<http://www.proofexistencegod.com/will-of-god/will-of-god/>  :
Logical
reasons - based on scientific premises - for the existence of a Super
intelligent and Orderly Creator and that He hasn't left His sapient
creatures without an Instruction Manual - Torah ['books of Moses'] - to
ascertain, and aspire to, His purpose.

[Company] Anders Branderud IT Solutions - www.abitsolutions.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20110617/4c7f6864/attachment-0002.htm>


More information about the Users mailing list