Adding Users In James
To add users in James, you must use the Remote Manager. This is a command-line utility used to manage user accounts. The user account info is stored on the file system. You can also manage user accounts in an RDBMS. I will cover configuring James to use an RDBMS in a later post. You can use a database to handle some tasks (like storing mail), while using the file system for others (such as managing users). I will cover using a database in a later post.
The default James configuration file has a section for the Remote Manager beginning on line 778, and ending on line 806. To use the Remote Manager, you must telnet to the machine running James on the port specified in the configuration file. By default it is port 4555. The James web site has a page about configuring the Remote Manager, but I was not able to find any information about using it. It is pretty easy to use, but it would be nice if there was a list of the commands. You can get a list of the commands by typing help:
Welcome root. HELP for a list of commands
help
Currently implemented commands:
help display this help
listusers display existing accounts
countusers display the number of existing accounts
adduser [username] [password] add a new user
verify [username] verify if specified user exist
deluser [username] delete existing user
setpassword [username] [password] sets a user’s password
setalias [user] [alias] locally forwards all email for ‘user’ to ‘alias’
showalias [username] shows a user’s current email alias
unsetalias [user] unsets an alias for ‘user’
setforwarding [username] [emailaddress] forwards a user’s email to another email address
showforwarding [username] shows a user’s current email forwarding
unsetforwarding [username] removes a forward
user [repositoryname] change to another user repository
shutdown kills the current JVM (convenient when James is run as a daemon)
quit close connection
Here is a quick sample session:
user@machine:/path/to/james$ telnet localhost 4555
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
JAMES Remote Administration Tool 2.3.1
Please enter your login and password
Login id:
rmusername
Password:
rmpassword
Welcome rmusername. HELP for a list of commands
verify Grumpy
User Grumpy exists
adduser genericuser badpassword
User genericuser added
verify genericuser
User genericuser exists
^[[A^[[B
Unknown command
listusers
Existing accounts 4
user: Happy
user: Grumpy
user: Sleepy
user: genericuser
deluser genericuser
User genericuser deleted
listusers
Existing accounts 3
user: Happy
user: Grumpy
user: Sleepy
quit
Bye
Connection closed by foreign host.
user@machine:/path/to/james$
I have been able to configure James to use a database to store and process messages, but I have not been successful in getting James to use a database to store and manage user accounts. I read on the mailing list that the password must be encrypted using a particular algorithm (SHA I believe). The password must be encrypted using Java’s implementation of the algorithm, and not the database’s. I have not looked into this in any great detail. I plan in configuring James to use a database to manage users.
The James site has a page on adding user accounts via the Remote Manager, but nothing that I can see on using a database for this purpose. (There is an introductory page on setting up a database.) There is an XML file included with James that has the SQL statements that James uses for every database operation, but it did not give many answers (or perhaps I did not read it thoroughly enough). But there is nothing wrong with doing this in stages.
Updated:
2009-02-16 00:37:33 Monday CST -0600
Chicago Java Users Group (CJUG)
Code Academy Alumni
MacAdie Twitter Feed