Skip to content

Instantly share code, notes, and snippets.

@dougalcorn
Created July 18, 2013 13:33
Show Gist options
  • Save dougalcorn/6029329 to your computer and use it in GitHub Desktop.
Save dougalcorn/6029329 to your computer and use it in GitHub Desktop.
Problems with registering my first user from the command line on ejabberd on ubuntu
{hosts, ["localhost", "semperubisububi.org"]}.
{access, max_user_sessions, [{10, all}]}.
{access, max_user_offline_messages, [{5000, admin}, {100, all}]}.
{access, local, [{allow, all}]}.
{access, c2s, [{deny, blocked},
{allow, all}]}.
{access, c2s_shaper, [{none, admin},
{normal, all}]}.
{access, s2s_shaper, [{fast, all}]}.
{access, announce, [{allow, admin}]}.
{access, configure, [{allow, admin}]}.
{access, muc_admin, [{allow, admin}]}.
{access, muc, [{allow, all}]}.
{access, register, [{allow, all}]}.
{access, pubsub_createnode, [{allow, all}]}.
{acl, local, {user_regexp, ""}}.
{auth_method, internal}.
{loglevel, 5}.
{listen,
[
{5222, ejabberd_c2s, [
{access, c2s},
{shaper, c2s_shaper},
{max_stanza_size, 65536},
%%zlib,
starttls, {certfile, "/etc/ejabberd/ejabberd.pem"}
]},
{5269, ejabberd_s2s_in, [
{shaper, s2s_shaper},
{max_stanza_size, 131072}
]},
{5280, ejabberd_http, [
%%{request_handlers,
%% [
%% {["pub", "archive"], mod_http_fileserver}
%% ]},
%%captcha,
http_bind,
http_poll,
web_admin
]}
]}.
{max_fsm_queue, 1000}.
{s2s_use_starttls, true}.
{s2s_certfile, "/etc/ejabberd/ejabberd.pem"}.
{shaper, normal, {maxrate, 1000}}.
{shaper, fast, {maxrate, 50000}}.
{language, "en"}.
{modules,
[
{mod_adhoc, []},
{mod_announce, [{access, announce}]}, % requires mod_adhoc
{mod_caps, []},
{mod_configure,[]}, % requires mod_adhoc
{mod_admin_extra, []},
{mod_disco, []},
%%{mod_echo, [{host, "echo.localhost"}]},
{mod_irc, []},
{mod_last, []},
{mod_muc, [
{access, muc},
{access_create, muc},
{access_persistent, muc},
{access_admin, muc_admin},
{max_users, 500}
]},
%%{mod_muc_log,[]},
{mod_offline, [{access_max_user_messages, max_user_offline_messages}]},
{mod_privacy, []},
{mod_private, []},
{mod_proxy65, [
{access, local},
{shaper, c2s_shaper}
]},
{mod_pubsub, [ % requires mod_caps
{access_createnode, pubsub_createnode},
{pep_sendlast_offline, false},
{last_item_cache, false},
%%{plugins, ["default", "pep"]}
{plugins, ["flat", "hometree", "pep"]} % pep requires mod_caps
]},
{mod_register, [
{welcome_message, {"Welcome!",
"Welcome to a Jabber service powered by Debian. "
"For information about Jabber visit "
"http://www.jabber.org"}},
{access, register}
]},
{mod_roster, []},
%%{mod_service_log,[]},
%%{mod_shared_roster,[]},
{mod_stats, []},
{mod_time, []},
{mod_vcard, []},
{mod_version, []}
]}.

I'm setting up an ejabberd server on an Ubuntu LTS 12.04. The community help wiki says I just need to:

  1. Install the package
  2. Edit the hosts configuration in ejabberd.cfg
  3. Update the admin user's definition
  4. Restart the server
  5. Register the admin user from the command line

It's that last step that doesn't work. Here's what I get:

$ sudo ejabberdctl register ejabberd semperubisubsubi.org <password>
Can't register user [email protected] at node '[email protected]': not_allowed

There are a bunch of Google hits for "ejabber register not_allowed". I've spent about four or five hours reading them all. I still can't figure this out. I could really use some help.

I know most of the posts talk about making sure you have agreement between your hostname, your hosts definition, and your node name. The Ubuntu init scripts are setup to use /etc/defaults/ejabberd to override some of the settings via environment variables. The only thing I have in there is this line:

[email protected]

Which corresponds to my hostname:

$ hostname
semperubisububi.org
$ hostname -f
localhost
$ hostname -s
semperubisububi

I think that hostname -f is due to adding my FQDN to my /etc/hosts:

127.0.0.1  localhost susu semperubisububi.org

Oh, I also found a post that says there's a tight bind between the hostname of your machine and the ejabberd configuration. I think while I was wrestling with this setup, I got that mucked up. The post said to rm /var/lib/ejabberd/* and restart. I wasn't actually able to get the server running properly until I did that. I know the server is running properly:

 sudo ejabberdctl status
The node '[email protected]' is started with status: started
ejabberd 2.1.10 is running in that node

And I can see the processes running:

$ ps -ef | grep eja[b]
ejabberd  1152     1  0 13:19 ?        00:00:00 /usr/lib/erlang/erts-5.8.5/bin/beam -K false -P 250000 -- -root /usr/lib/erlang -progname erl -- -home /var/lib/ejabberd -- -name [email protected] -pa /usr/lib/ejabberd/ebin -s ejabberd -kernel inetrc "/etc/ejabberd/inetrc" -ejabberd config "/etc/ejabberd/ejabberd.cfg" log_path "/var/log/ejabberd/ejaberd.log" erlang_log_path "/var/log/ejabberd/erlang.log" -sasl sasl_error_logger false -mnesia dir "/var/lib/ejabberd" -smp disable -noshell -noshell -noinput
ejabberd  1165  1152  0 13:19 ?        00:00:00 inet_gethost 4
ejabberd  1166  1165  0 13:19 ?        00:00:00 inet_gethost 4
ejabberd 30056     1  0 02:43 ?        00:00:00 /usr/lib/erlang/erts-5.8.5/bin/epmd -daemon
@dougalcorn
Copy link
Author

I've also created a thread on the ejabberd forums to solicit help

@dougalcorn
Copy link
Author

I'm not yet giving up, but this is literally the only response I've gotten:

"Uninstall ejabberd and install prosody? That's what I ended up doing." -- @paulv

https://twitter.com/paulv/status/357869304156401664

Copy link

ghost commented May 29, 2015

I know this is 2 years old, but i ended up here looking for an answer. Found it, so here it is for you:
run ejabberdctl register <username> <hostname> <password>

For info, it works with the following config

  • in my ejabberctl.cfg, I have ERLANG_NODE=ejabberd

  • in my ejabberd.yml I have hosts: []

  • in my /etc/hosts, the following 2 lines :

    0.0.0.0 hostname
    0.0.0.0 hostname.domain hostname

you could, of course, bind it to specific interfaces...
Hope that helps !

@akatov
Copy link

akatov commented Jul 21, 2015

can it be that you mistyped semperubisubsubi.org in your config file?
As an alternative, have you tried registering a user with the localhost hostname?

@PaulSchulz
Copy link

I was getting a similar error, but I am using ejabberd 14.07-4+deb8u1 on raspbian. It is using a yml configuration file.

I managed to get past the set giving the above problem by not removing the 'localhost' in the 'acl' setting for admin users. Looks like it's needed for 'ejabberdcfg'. I wanted to get rid of the 'localhost' reference.

' ACCESS CONTROL LISTS

acl:

The 'admin' ACL grants administrative privileges to XMPP accounts.

You can put here as many accounts as you want.

admin:
user:
- "": "localhost"

@winvinay
Copy link

I faced similar issue, add a entry in ejabberd.cfg like below
{acl, admin, {user, "admin", "example.com"}}

then run command
ejabberdctl register admin example.com password
User [email protected] successfully registered

@g0ldstrike
Copy link

g0ldstrike commented Nov 22, 2016

I solved it as follows on Ubuntu 16.04:

In /etc/ejabberd/ejabberd.yml, make sure that your domain is present under hosts :

hosts:
  - "localhost"
  - "semperubisububi.org"

To my surprise, this is not noted in the installation guide, but it did not work for me until adding the host here.

@godfather68
Copy link

@g0ldstrike thanks . That was it

@kpv1993
Copy link

kpv1993 commented Mar 2, 2017

It worked. Thanks man

@optimusng
Copy link

i do like this :
-purge all package
apt-get purge ejabberd ejabberd-)
-config hostname in /etc/hostname : this hostname will be used in ejabberdctl script
-reinstall
apt-get install ejabberd ejabberd-

-config /etc/hosts, add your hostname, ex : xmppchat.org
-config ejabberd serving hosts :
hosts :
- "localhost"
- "xmppchat.org"
-then just register user :
ejabberdctl register admin xmppchat.org 123abc

@greendancingmonkey
Copy link

greendancingmonkey commented Mar 20, 2018

[SOLVED _SEE BELOW]

I'm having the same problem with a Raspberry Pi 3 - Raspbian Stretch.
I've updated /etc/ejabberd/ejabberd.yml - actually my hostname was already in there but "localhost" wasn't, so added it for the hell of it.
I then ran the command as per above,

$ sudo ejabberdctl register ejabberd semperubisubsubi.org

. I run:

$ sudo ejabberdctl register ejabberd <my host name.com> <password>

but I get:

Error: cannot_register

I've also tried the above as root i.e.,:

sudo su.

Please can someone clarify what the correct command is to register an admin user so that I can login to the web admin?

Thanks...

@greendancingmonkey
Copy link

greendancingmonkey commented Mar 20, 2018

Got it....I'm running ejabberd on a Rasberry Pi 3 with a FreedomBox software install - https://wiki.debian.org/FreedomBox - and the admin for ejabberd must be setup by FreedomBox to be the FreedomBox admin, domain and password. To make sure I was using the right domain I ran the following command in the commandlline:

hostname -s

my login is:
Username: [FreedoBox admin name]@[domain]
Password: [FreedomBox admin password]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment