Create new account from command line
From PTAGISWiki
Normally, users create accounts for themselves through the web interface. There is also a web interface for PTAGIS Administrators to create new accounts. Both of these web interfaces use the java class util.SEFInterface. If necessary, this class can be executed from the command line. This might be necessary when troubleshooting. Here is the procedure:
- login to one of the cluster machines
- cd $PTAGIS_ROOT
- bin/run.sh util.SEFInterface web/ptagis/WEB-INF/sef.properties createAccount <username> <password> '""'
More information about creating new accounts is in install/maintenance doc section 4.1.6.2, 4.1.6.3, 4.2.1
For example:
bash-2.05# pwd /global/ds1/pitweb/ptagis-1.0 bash-2.05# bin/run.sh util.SEFInterface web/ptagis/WEB-INF/sef.properties createAccount dlwarf newuser '""'
after running the bin/run.sh command, you'll see something like this:
propsFilePath=web/ptagis/WEB-INF/sef.properties nResult=200 statusCode=200 statusText=OK responseBody=Account for user dlwarf is created. Could not synchronize with LDAP. LDAP Server setting is empty. Could not add user to the group . createAccount(): failed Account for user dlwarf is created. Could not synchronize with LDAP. LDAP Server setting is empty. Could not add user to the group . DONE.
If you get this message:
createAccount(): failed Account creation failed. <!--Error code:10--> Error message: Execution of this operation was denied by license policies.
It means that there isn't room to create an account and someone must be deleted before creating a new one. After upgrading LDAP and SREE to 7.0 the new account class began to fail. The user would see no error, and in fact be send an email with their account and password. But this shows up in weblogic stdout:
LDAPUserMgr.LDAPUserMgr()
LDAPConnection.connect()
LDAPUserMgr.doesUserExist(deleteme4)
LDAPUserMgr.createUser(deleteme4)
LDAPUserMgr.addUserToLDAP()
javax.naming.NamingException. Root exception is
java.io.NotSerializableException:
javax.naming.directory.InitialDirContext at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1330)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1302)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1245)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
at com.sun.jndi.ldap.Obj.serializeObject(Obj.java:485) at
com.sun.jndi.ldap.Obj.encodeObject(Obj.java:151) at
com.sun.jndi.ldap.Obj.determineBindAttrs(Obj.java:579) at
com.sun.jndi.ldap.LdapCtx.c_bind(LdapCtx.java:356) at
com.sun.jndi.ldap.LdapCtx.c_bind(LdapCtx.java:325) at
com.sun.jndi.toolkit.ctx.ComponentContext.p_bind(ComponentContext.java:592)
at
com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(PartialCompositeContext.java:179)
at
com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(PartialCompositeContext.java:169)
at javax.naming.InitialContext.bind(InitialContext.java:355) at
ldap.LDAPUserMgr.addUserToLDAP(LDAPUserMgr.java:406) at
jsp_servlet.__createaccount._jspService(__createaccount.java:778) at
weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6291)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3575)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2573)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
LDAPGroupMgr.LDAPGroupMgr()
LDAPConnection.connect()
And if I run the java class directly, it looks like this:
reedi.psmfc.org:C1:root: > bin/run.sh util.SEFInterface web/ptagis/WEB-INF/sef.properties createAccount deleteme newuser '""' propsFilePath=web/ptagis/WEB-INF/sef.properties createAccount(): failed Account for user deleteme is created. Could not synchronize with LDAP. -1 Could not add user to the group . DONE.
