

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
8 messages in org.apache.james.server-userRe: Using the API to Dynamically Add ...| From | Sent On | Attachments |
|---|---|---|
| Don Kim | Apr 12, 2005 9:30 am | |
| Alan Gerhard | Apr 13, 2005 4:26 pm | |
| Daniel Perry | Apr 14, 2005 2:26 am | |
| Davide Dalla Rosa | Apr 14, 2005 2:41 am | |
| Daniel Perry | Apr 14, 2005 2:43 am | |
| Jason Webb | Apr 14, 2005 3:38 am | |
| Steve Short | Apr 14, 2005 9:52 am | |
| John G. Norman | Apr 16, 2005 4:45 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Using the API to Dynamically Add Users | Actions... |
|---|---|---|
| From: | John G. Norman (john...@gmail.com) | |
| Date: | Apr 16, 2005 4:45:44 am | |
| List: | org.apache.james.server-user | |
Just to go back to James Dalla Rosa's posting on this topic -- creating users automatically by opening a socket --
If you use Ant, it's pretty easy to do some scripting to add "standard" users. Put the Jakarta Commons Net into your ant lib/ , and then do something like the following:
<target name="James-create-users" description="Create users for the James mail server"> <telnet server="localhost" port="4555" timeout="5"> <read>id:</read> <write>root</write> <read>Password:</read> <write>root</write> <read>commands</read> <write>adduser john john</write> <read>added</read> <write>adduser hans hans</write> <read>added</read> <write>adduser stan stan</write> <read>added</read> <write>adduser katie katie</write> <read>added</read> <write>adduser james james</write> <read>added</read> <write>quit</write> </telnet> </target>
Here is another Ant target I wrote to set up James on a machine (I use James for testing e-mail on developer machines). A tidbit here, too, is that we run James POP and SMTP on 8110 and 8025 and redirect ports on Linux and BSD so that James doesn't have to run as root (to get access to the privileged ports).
<target name="James-prepare" depends="filter" description="Prepare the James mail server"> <echo message="Eclipse users, NOTE:"/> <echo message=" You must add JAF (activation.jar), JavaMail (mail.jar) and"/> <echo message=" Commons Net (commons-net-1.3.0.jar) to your Eclipse Ant"/> <echo message=" Runtime (Window / Preferences / Ant/ Runtime / add external"/> <echo message=" jars to the Ant Global Entries section)."/> <!-- On the Mac, must:
sysctl -w net.inet.ip.forwarding=1 ipfw add fwd 127.0.0.1,8110 tcp from any to any 110 in ipfw add fwd 127.0.0.1,8025 tcp from any to any 25 in -->
<delete quiet="true" dir="${env.OTS}/james-2.2.0"/> <unzip src="${env.OTS}/james-2.2.0.zip" dest="${env.OTS}"/> <exec os="Linux,Mac OS X" executable="/bin/bash"> <arg line='-c "chmod +x ${james.base.dir}/bin/run.sh"' /> </exec> <exec os="Linux,Mac OS X" executable="/bin/bash"> <arg line='-c "chmod +x ${james.base.dir}/bin/phoenix.sh"' /> </exec>
<!-- Now set our custom config.xml --> <copy verbose="true" file="${config}/james-config.xml" overwrite="true" tofile="${james.base.dir}/apps/james/SAR-INF/config.xml" />
<!-- Startup / shutdown to get James initialized --> <antcall target="James-start"/> <echo message="Waiting 10 seconds for James to start up . . ."/> <sleep seconds="10"/> <antcall target="James-shutdown"/> <sleep seconds="5"/>
<antcall target="James-start"/>
<echo message="Waiting 30 seconds for James to start up . . ."/>
<sleep seconds="30"/>
<antcall target="James-create-users"/>
<antcall target="James-test-email"/>
</target>
<target name="James-start" description="Start the James mail server">
<java fork="yes" spawn="yes"
jar="${james.base.dir}/bin/phoenix-loader.jar" taskname="james">
<sysproperty key="java.ext.dirs" value="${james.base.dir}/lib"/>
<sysproperty key="phoenix.home" value="${james.base.dir}"/>
<sysproperty key="java.security.policy"
value="jar:file:${james.base.dir}/bin/phoenix-loader.jar!/META-INF/java.policy"/>
</java>
</target>
<target name="James-shutdown" description="Shut down the James mail server">
<telnet server="localhost" port="4555" timeout="5">
<read>id:</read>
<write>root</write>
<read>Password:</read>
<write>root</write>
<read>commands</read>
<write>shutdown</write>
<write></write>
</telnet>
</target>







