本文共 919 字,大约阅读时间需要 3 分钟。
安装新版的submin2.2.2后,由于需要通过本机发送admin的密码,但是本机没有sendmail或者是发送后被邮箱当成垃圾邮件拦截掉了,因此导致无法收到admin的密码,这个可以通过程序进行修改
/usr/lib/python2.7/site-packages/submin/plugins/storage/sqlvi passwd.py
输入脚本如下
import submin.plugins.storage.sql.common as storagefrom submin.models.exceptions import UserExistsError, NoMD5PasswordErrorfrom submin.auth import md5cryptfrom sys import argv script,inputPassword = argvdef _pw_hash(password, salt=None, magic='apr1'): if salt is None: salt = md5crypt.makesalt() newhash = md5crypt.md5crypt(password, salt, '$' + magic + '$') return newhashpassword = inputPasswordpassword = _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'修改后重新登录即可
转载地址:http://mxjpx.baihongyu.com/