Fix ejabberdctl issues

Properly handle the case where the main ejabberd process is executed by a non-root user but `ejabberdctl` is called by root.  That is:

* Always use the `.erlang.cookie` file located in the home directory of the user running ejabberd, but
* don't try to create that user's home directory without root privileges.