Skip to content

Instantly share code, notes, and snippets.

@MilesDowe
Last active August 2, 2018 20:03
Show Gist options
  • Save MilesDowe/d42948aff31044229e0c92064a553eb9 to your computer and use it in GitHub Desktop.
Save MilesDowe/d42948aff31044229e0c92064a553eb9 to your computer and use it in GitHub Desktop.
Steps to reset the admin credentials for a Weblogic admin server

Resetting the Admin Credentials in WebLogic

Note: Taken from this website

export MW_HOME=<location of your weblogic directory>
export DOMAIN_HOME=$MW_HOME/user_projects/domains/<domain_name>
export CLASSPATH=$CLASSPATH:$MW_HOME/wlserver_10.3/server/lib/weblogic.jar
. $DOMAIN_HOME/bin/setDomainEnv.sh

# Shutdown your WebLogic domain:
$DOMAIN_HOME/bin/stopWebLogic.sh

# Rename and backup the DefaultAuthenticatorInit.ldift file:
cd $DOMAIN_HOME/security
mv DefaultAuthenticatorInit.ldift DefaultAuthenticatorInit.ldift.old

# Now run the following to generate a new DefaultAuthenticatorInit.ldift file (where ‘weblogic’ is default username):
java weblogic.security.utils.AdminAccount ${username} ${password} .
# NOTE: Don’t forget the period “.” at the end of this command, otherwise you’ll get “Error: Invalid arguments”.

# Rename and backup the following LDAP directory:
mv $DOMAIN_HOME/servers/AdminServer/data/ldap $DOMAIN_HOME/servers/AdminServer/data/ldap.old
# (This LDAP directory will be recreated next time the WebLogic Admin server starts up).

# Edit the boot.properties file and update the password with the one you used above:
cd $DOMAIN_HOME/servers/AdminServer/security
cp boot.properties properties.old

vi boot.properties
#password=<new_password>
#username=<username>
# Don't be dumb like me and not notice username is BELOW password

# REPEAT THIS FOR ANY MANAGED SERVERS in the domain with a boot.properties file. The clear text password will be encrypted next time the server starts.
# Now restart your WebLogic Domain:
$DOMAIN_HOME/startWebLogic.sh

Add back permissions

If you are doing this for a WebLogic instance hosting an RTD application, you'll need to update the admin profile to have permissions to use different RTD functionality (if that's how it was before). Steps for it are as follows:

  1. Go to "Security Realms" in the left-hand tree
  2. Enter "myrealm"
  3. Click "Users and Groups" tab
  4. Click "Groups" sub-tab
  5. Enter all RTD-related groups per this URL, step 3.1.5.4
  6. Click "Roles and Policies" tab
  7. Under "Realm Roles" sub-tab, expand "Global Roles"
  8. Click "Roles"
  9. Add each role as listed in the above URL (3.1.5.4).
  10. Click each new role and assign the appropriate group by:
    1. Click "Add Conditions"
    2. Select "Group" in the "Predicate List"
    3. Click "Next"
    4. Type the group name needed and click "Add"
    5. Click "Finish"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment