That returns NULL, which would normally leave me to believe it's successful. However, the user isn't actually created. After further testing, I learned the following:
array ( 'stdout' => '', 'stderr' => 'sh: ejabberdctl: command not found ', 'return' => 127, )
I discovered from the CLI that running as a normal user, rather than root, that's the same error returned when attempting to run ejabberdctl. So then I searched for the executable, and changed it to /usr/sbin/ejabberdctl. Running that from the command line gives me:
$ /usr/sbin/ejabberdctl status RPC failed on the node ejabberd@vserver147: nodedown $ /usr/sbin/ejabberdctl ejabberd@vserver147 status RPC failed on the node ejabberd@vserver147: nodedown $ /usr/sbin/ejabberdctl ejabberd@xmpp.example.com status RPC failed on the node ejabberd@vserver147: nodedown
To make matters more confusing sending /usr/sbin/ejabberd, from PHP, I now get:
array ( 'stdout' => '', 'stderr' => 'erlexec: HOME must be set ', 'return' => 1, )
Searching around, I now discovered that erl REQUIRES a user have the $HOME variable set, which apparently the www-root user doesn't get by default. I tried running $HOME=/tmp before the ejabberd command, but that didn't seem to work. I guess I can dig into how to assign the variable to a user I don't have command line access to, but I suspect it still won't work because of the RPC failure.
and yes, i've also tried
and yes, i've also tried running the commands as root -- they execute properly.
how to allow non-root users to run ejabberdctl?
So now I added at the beginning,
putenv("HOME=/tmp");
and got:
array (
'stdout' => 'RPC failed on the node ejabberd@vserver147: nodedown
',
'stderr' => '',
'return' => 3,
)
At least it's now at the same place as other users. So now the question is how to allow non-root users to run ejabberdctl...
The ejabberd installation
The ejabberd installation when using the source package assumes that only root can run ejabberdctl.
However, if you add the option
and then install it, then both root and somesystemuser will be able to run ejabberdctl.
I checked if it was possible to get any other system user to run ejabberdctl, by adding him to the somesystemuser group, but it didn't work: