# Taiga superuser login problem

**URL:** <https://community.taiga.io/t/taiga-superuser-login-problem/5343>\
**Category:** Troubleshooting\
**Tags:** docker\
**Created:** [February 16, 2025, 10:38am UTC](https://community.taiga.io/t/taiga-superuser-login-problem/5343 "2025-02-16T10:38:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raana\_tashakkori](https://dub1.discourse-cdn.com/flex017/user_avatar/community.taiga.io/raana_tashakkori/32/3775_2.png) [@raana\_tashakkori](https://community.taiga.io/u/raana_tashakkori)\
**Post date:** [February 16, 2025, 10:38am UTC](https://community.taiga.io/t/taiga-superuser-login-problem/5343/1 "2025-02-16T10:38:21Z")

</div>

I installed taiga using docker and created a superuser, but I can’t log in with the created username.  
I ran `python manage.py shell` and tried to change the password with python codes and try again, but it still has a problem.

This is my first time running taiga.

---

<div class="post-metadata">

**Author:** ![csmu](https://dub1.discourse-cdn.com/flex017/user_avatar/community.taiga.io/csmu/32/2289_2.png) [@csmu](https://community.taiga.io/u/csmu)\
**Post date:** [February 20, 2025, 3:14am UTC](https://community.taiga.io/t/taiga-superuser-login-problem/5343/2 "2025-02-20T03:14:59Z")

</div>

> [@raana\_tashakkori](#):
>
> I installed taiga using docker and created a superuser, but I can’t log in with the created username.

You are a super user as soon as you login to a Django session. You can do anything you want to the entire database. Here is some diagnostic code you can use.

```python
 ./taiga-manage.sh shell

Python 3.11.9 (main, Jul 10 2024, 19:07:14) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth import get_user_model
>>> User = get_user_model()
>>> superusers = User.objects.filter(is_superuser=True)
>>> for user in superusers:
... print(f"Username: {user.username}, Email: {user.email}, ID: {user.id}")
... 
Username: 'user-name', Email: 'email-address@domain', ID: n

```

In Django, you can update the password for a user with `id=0` (if such a user exists) using the following code:

```python
user = User.objects.filter(id=0).first() # Get user with ID 0

if user:
    user.set_password("new_secure_password") # Replace with your desired password
    user.save()
    print("Password updated successfully.")
else:
    print("User with ID 0 not found.")

```

Explanation:

- `User.objects.filter(id=0).first()` fetches the user with `id=0`, if they exist.
- `user.set_password("new_secure_password")` securely hashes and sets the new password.
- `user.save()` saves the changes to the database.

To find a user by email and set them as a superuser in Django, use the following code:

```python
email_to_find = "user@example.com" # Replace with the actual email
user = User.objects.filter(email=email_to_find).first()

if user:
    user.is_superuser = True # Grant superuser privileges
    user.is_staff = True # Also needed for Django admin access
    user.save()
    print(f"User {user.username} is now a superuser.")
else:
    print("User not found.")

```

Explanation:

- `User.objects.filter(email=email_to_find).first()`  
retrieves the first user matching the given email.
- `user.is_superuser = True` grants superuser privileges.
- `user.is_staff = True` allows access to the Django admin panel.
- `user.save()` commits the changes to the database.

Cheers!
