使用管理员登录 JumpServer 堡垒机时遇到错误的处理
多次密码错误,或长时间不登陆导致密码失效用户被禁用,可以通过服务器内部进行重置处理
# 进入容器内部
docker exec -it jumpserver /bin/bash
# 进入目录
cd /opt/jumpserver/apps/
# 如果遇到错误:ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
# 可以执行以下命令激活 python 环境(可能 v4 容器需要)
source /opt/py3/bin/activate
# 进入 python 环境
python manage.py shell
# 或
python3 manage.py shell
# 重置用户密码
from users.models import User
u = User.objects.get(username='admin')
u.reset_password('admin')
u.save()
# 解锁登录限制
from django.core.cache import cache
cache.delete_pattern('_LOGIN_BLOCK_*')
cache.delete_pattern('_LOGIN_LIMIT_*')
# 启用禁用的用户:
from users.models import User
User.objects.filter(username='admin').update(is_active=True)
参考:
https://blog.csdn.net/firmament0422/article/details/136195863
https://kb.fit2cloud.com/?p=53
输了你,赢了世界又如何...

浙公网安备 33010602011771号