Forgot admin username or password
Introduction
Forgotten passwords can be resolved most of the time by using the "reset password" link on the login page. However, there may be scenarios where a user cannot get email for some reason. In this case, an administrator may reset a password via the shell.
Reset password via shell access
If you don't know the email for admin user you first need to fetch that which you can do through mysql.
SSH into your edx server and connect to your MySQL database. E.g.:
mysql -u root
change the database to edxapp
use edxapp;
View auth username and email. Note the username.
select username,email from auth_user;
Exit MySQL. Run the commands to reset a users password.
sudo -H -u edxapp bash
cd /edx/app/edxapp/edx-platform
source /edx/app/edxapp/edxapp_env
python manage.py lms changepassword [username]
You are able to reset the password and provide that password to the user.
Create new user using command line
You can also create a new superuser using django command line interface just by using the below command.
sudo su edxapp -s /bin/bash
source /edx/app/edxapp/edxapp_env
cd
/edx/bin/python.edxapp /edx/bin/manage.edxapp lms manage_user username_here email_here@example.com --staff --superuser --settings=aws
Note: The --staff and --superuser flags give the user staff and superuser access. Omit them for users without these roles.