安装新版的submin2.2.2后,由于需要通过本机发送admin的密码,但是本机没有sendmail或者是发送后被邮箱当成垃圾邮件拦截掉了,因此导致无法收到admin的密码,这个可以通过程序进行修改
/usr/lib/python2.7/site-packages/submin/plugins/storage/sql vi passwd.py
输入脚本如下
import submin.plugins.storage.sql.common as storage from submin.models.exceptions import UserExistsError, NoMD5PasswordError from submin.auth import md5crypt from sys import argv script,inputPassword = argv def _pw_hash(password, salt=None, magic='apr1'): if salt is None: salt = md5crypt.makesalt() newhash = md5crypt.md5crypt(password, salt, '$' + magic + '$') return newhash password = inputPassword password = _pw_hash(password) print password
执行脚本
[root@localhost sql]# python2 passwd.py 123456 $apr1$ahzk2phT$FROlECwi3g5wPQEjflSFq0 [root@localhost sql]#
修改admin的密码
cd /xxx/submin/conf/ sqlite3 submin.db sqlite3> update user set password='$apr1$ahzk2phT$FROlECwi3g5wPQEjflSFq0' where name='admin'
修改后重新登录即可
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/185019.html