First time login to Apache Airflow asks for username and password, what is the username and password?

Viewed 43469

I've just installed Apache Airflow, and I'm launching the webserver for the first time, and it asks me for username and password, I haven't set any username or password.

Can you let me know what is the default username and password for airflow?

enter image description here

5 Answers

There is no default username and password created if you are just using python wheel.

Run the following to create a user:

For Airflow >=2.0.0:

airflow users  create --role Admin --username admin --email admin --firstname admin --lastname admin --password admin

OR

For Airflow <1.10.14:

airflow create_user -r Admin -u admin -e admin@example.com -f admin -l user -p admin

By default, if you are using the docker-compose example provided by airflow, the user is:

user: airflow 
password: airflow

If you want to create another account with docker use this (you have to be in the same folder of the docker-compose.yaml file):

docker-compose run airflow-worker airflow users create --role Admin --username admin --email admin --firstname admin --lastname admin --password admin

Where to get the Dockerfile?

The example is provided by airflow at this link

How to build it:

  • download the file and saved it with the name docker-compose.yaml
  • run the command docker-compose build . This will create the container needed for running airflow
  • run the command docker-compose up to start the application
  • Using this example, the default user is already created by the airflow-init container. If u want to create another user, use the command above

I installed AF from hub.docker.com and ran it

docker run -dit --name af --rm -p 8080:8080 apache/airflow standalone

In this case defaul user is "admin" but password shows nowhere and stores in 'standalone_admin_password.txt'. To see the password run:

docker exec af cat standalone_admin_password.txt

Since 2.3.2:

For anyone getting into Your user has no roles and/or permissions! after creating user with following command :

airflow users create \
    --username admin \
    --firstname Peter \
    --lastname Parker \
    --role Admin \
    --email spiderman@superhero.org

You need to sync-perm manually with airflow sync-perm.

After installing Airflow 2.3.4 via pip, and running airflow standalone, none of the existing answers worked for me (excluding the docker ones, which I did not try) - I could not login with admin:admin.

Running airflow users create ... reported that the admin user already existed.

(Also need to be sure to export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH otherwise the users create command failed due to picking up an old version of sqllite).

Running airflow sync-perm made no apparent difference.

After restarting Airflow I noticed that a randomly-generated admin password is logged in the server console, and this logged me in correctly:

standalone | Airflow is ready
standalone | Login with username: admin  password: 9fghj2bghT06GBhS

This password is also written to $AIRFLOW_HOME/standalone_admin_password.txt (but this is not updated if you later change the password manually via the web UI)

Related