Go up: WikiStart

6. Common Administrative Tasks

This section attempts to provide a guide for the most common day-to-day Jabberd administrative tasks, including user management.

  • Starting and Stopping Jabberd 2
  • Converting from Jabberd 1.4
  • Adding Users
  • Removing Users
  • Sending MOTD's and Messages to All Online Users

Detailed configuration information begins in the next section.

6.1. Starting and Stopping Jabberd 2

This section describes how to start and stop the Jabberd 2 binaries. See Appendix 7 for running Jabberd 2 with an RC script or Appendix 8 for running Jabberd 2 using Daemontools.

6.1.1. Starting Jabberd 2

The jabberd start script starts the Jabberd 2 server. This script is installed in the same directory with the Jabberd 2 binaries (/usr/local/jabberd by default). To start the server, switch to the jabber user and run the start script:

su jabber /usr/local/bin/jabberd

The script handles the starting of the five Jabberd 2 binaries. The script assigns the relevant configuration file (located in /usr/local/etc/jabberd by default) for each Jabberd 2 binary.

6.1.2. Stopping Jabberd 2

There is currently no shutdown script for Jabberd 2; therefore, the five Jabberd 2 processes must be killed manually in order to shut the server down. To stop the server, kill the following processes (either as root or the jabber user):

router resolver sm c2s s2s

Stopping one of the processes above may cause another to die; however, it is important to make sure that all Jabberd 2 proccesses have died before attempting a restart. A single running process may prevent the server from restarting.

6.2. Converting from Jabberd 1.4

Robert Norris, the primary Jabberd developer, has created a Perl script that migrates Jabberd 1.4 data to either MySQL or PostgreSQL. Specifically, the script migrates only authentication information and rosters. The migrate.pl script is currently available from CVS on jabberstudio.org; however, it will be released with the next Jabberd 2 release.

Essentially, the script works as a service that connects to an existing Jabberd 1.4 installation, and it exports to an existing Jabberd 2 database. It has several dependencies (as listed in the script):

  • XML::Stream 1.17 or higher (from JabberStudio?)
  • Net::Jabber 1.29 or higher (from JabberStudio?)
  • Digest::SHA1
  • DBI
  • DBD::Pg or DBD::mysql

The migrate.pl file contains complete instructions for use.

6.3. Adding Users

At the time of writing, there are no scripts for adding users; however, users can be added easily to a MySQL or PostgreSQL database. This section describes how to add a user to a MySQL database. Adding a user to PostgreSQL, would be similar. This section assumes that public registration has been disabled (see Section 5.5).

N Note Jabberd 2 does not provide a facility for adding users to- or removing users from a Berkeley DB authentication store.

6.3.1. Enabling Auto-Create

The user section of sm.xml contains a tag named auto-create, and enabling this tag causes a user to be created in the storage package the first time a user logs on if that user does not yet exist in that database. With this tag enabled, users can be manually added to the authentication (authreg) database, and when each user logs in for the first time, Jabberd will create rosters, templates, etc. for that user. Specifically, the auto-create tag causes the user-create chain to be called when a new user logs in for the first time.

Auto-create is disabled by default. To enable it, uncomment the auto-create tag in the user section of the sm.xml file. This tag is near the end of the sm.xml file.

6.3.2. Creating Users from MySQL Console

Now that auto-create is enabled, you can create a user from the MySQL console.

Log onto the MySQL console as the Jabberd user:

mysql -u jabberd2 -p

From the MySQL console, Switch to the jabberd2 database:

mysql> use jabberd2

From the MySQL console, Insert a row into the authreg table. The row should contain values for username, realm and password :

mysql> insert into authreg (username, realm, password) -> values ('myusername', 'somedomain.com', 'mypassword');

Change the value of somedomain.com to match your configuration. In most cases, the realm will be the same as the ID of the Jabber server. Change myusername and mypassword to the name and password for your new user.

Your new user will now be able to log on using a Jabber client.

6.4. Removing Users

The MySQL console can be used to delete users from a MySQL authentication database (authreg). Enter this command to delete a user:

mysql> delete from authreg where username='the_user_name';

Note that deleting the user from the authreg table will not delete additional user data, such as rosters; however, once the user has been deleted from the authreg table, the user will no longer be able to log on to the Jabberd server.

6.5. Sending MOTD's and Messages to All Online Users

Sending MOTD's (Messages of the Day) and messages to all online users must be done from an administrative account with broadcast privileges. See Section 5.4 for information about how to assign these privileges. Once an account has broadcast privileges, these messages can be sent from a Jabber client. Add the following contacts to the administrative account you have created:

somedomain.com/announce

somedomain.com/announce/online

Sending a message to somedomain.com/announce will send a Jabber MOTD to all users on the domain. Offline users will receive the message the next time they log on. Sending a message to somedomain.com/announce/online sends a message only to online users. Note that if your Jabber client does not provide explicit support for MOTD's, you can add a contact with the JID's above, and use that contact to send MOTD's.


© 2003 Will Kamishlian and Robert Norris

http://jabberd.jabberstudio.org/2/docs/ccommons.gifThis work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.