安装新版的submin2.2.2后,由于需要通过本机发送admin的密码,但是本机没有sendmail或者是发送后被邮箱当成垃圾邮件拦截掉了,因此导致无法收到admin的密码,这个可以通过程序进行修改
1
2
|
/usr/lib/python2 .7 /site-packages/submin/plugins/storage/sql
vi passwd .py
|
输入脚本如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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
|
执行脚本
1
2
3
|
[root@localhost sql] # python2 passwd.py 123456
$apr1$ahzk2phT$FROlECwi3g5wPQEjflSFq0 [root@localhost sql] #
|
修改admin的密码
1
2
3
|
cd /xxx/submin/conf/
sqlite3 submin.db
sqlite3> update user set password= '$apr1$ahzk2phT$FROlECwi3g5wPQEjflSFq0' where name= 'admin'
|
修改后重新登录即可
本文转自yifangyou 51CTO博客,原文链接:http://blog.51cto.com/yifangyou/1972866,如需转载请自行联系原作者