From 73522dc4c1e83d3a14204879e8fc6af7eb438afb Mon Sep 17 00:00:00 2001 From: LI Yong Date: Thu, 7 Jan 2016 14:09:11 +0800 Subject: [PATCH] Ubuntu's passwd command doesn't support --stdin option, use chpasswd which is also available in CentOS --- juser/user_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/juser/user_api.py b/juser/user_api.py index 2c16c3dc7..d61ed7d95 100644 --- a/juser/user_api.py +++ b/juser/user_api.py @@ -151,8 +151,8 @@ def server_add_user(username, password, ssh_key_pwd='', ssh_key_login_need=True) add a system user in jumpserver 在jumpserver服务器上添加一个用户 """ - bash("useradd -s %s/connect.py '%s'; echo '%s'; echo '%s' | passwd --stdin '%s'" % - (BASE_DIR, username, password, password, username)) + bash("useradd -s %s/connect.py '%s'; echo '%s'; echo '%s:%s' | chpasswd " % + (BASE_DIR, username, password, username, password)) if ssh_key_login_need: gen_ssh_key(username, ssh_key_pwd)