Merge pull request #36 from chnliyong/master

Ubuntu的passwd命令不支持--stdin选项,使用chpasswd替代,在CentOS上已经验证有效
pull/39/merge
ibuler 2016-01-07 19:06:12 +08:00
commit 23b04fbbd7
1 changed files with 2 additions and 2 deletions

View File

@ -151,8 +151,8 @@ def server_add_user(username, password, ssh_key_pwd='', ssh_key_login_need=True)
add a system user in jumpserver add a system user in jumpserver
在jumpserver服务器上添加一个用户 在jumpserver服务器上添加一个用户
""" """
bash("useradd -s %s/connect.py '%s'; echo '%s'; echo '%s' | passwd --stdin '%s'" % bash("useradd -s %s/connect.py '%s'; echo '%s'; echo '%s:%s' | chpasswd " %
(BASE_DIR, username, password, password, username)) (BASE_DIR, username, password, username, password))
if ssh_key_login_need: if ssh_key_login_need:
gen_ssh_key(username, ssh_key_pwd) gen_ssh_key(username, ssh_key_pwd)