From 6be7003ac2e6102a21382cea420923cff5122c55 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 23 Feb 2016 17:40:33 +0800 Subject: [PATCH] =?UTF-8?q?bugfix(=E7=99=BB=E5=BD=95=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96)=20=E9=81=BF=E5=85=8D=E7=99=BB=E5=BD=95=E6=97=B6ctrl+?= =?UTF-8?q?c=E8=BF=9B=E5=85=A5=E7=B3=BB=E7=BB=9F=E5=86=85=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此bug信息见 #72 1. 修改思路 重命名zzjumpserver.sh,并移动到外层 2. 服务器添加用户时指定shell为 some_dir/jumpserver/init.sh 升级修复方案: 1. 删除/etc/profile.d/zzjumpserver.sh 2. git pull 更新 3. vim编辑 /etc/passwd,把之前建的用户的sh改为 some_dir/jumpserver/init.sh 终 Closes #72 closes #31 --- init.sh | 10 ++++++++++ install/zzjumpserver.sh | 13 ------------- juser/user_api.py | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) create mode 100755 init.sh delete mode 100644 install/zzjumpserver.sh diff --git a/init.sh b/init.sh new file mode 100755 index 000000000..f51e2f7d9 --- /dev/null +++ b/init.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# + +trap '' SIGINT +base_dir=$(dirname $0) + +export LANG='zh_CN.UTF-8' +python $base_dir/connect.py + +exit diff --git a/install/zzjumpserver.sh b/install/zzjumpserver.sh deleted file mode 100644 index 516b0466e..000000000 --- a/install/zzjumpserver.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -export LANG='zh_CN.UTF-8' - -if [ "$USER" != "admin" ] && [ "$USER" != "root" ];then - python /opt/jumpserver/connect.py - if [ $USER == 'guanghongwei' ];then - echo - else - exit 3 - echo - fi -fi diff --git a/juser/user_api.py b/juser/user_api.py index a6fc7648a..305a877fd 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'; echo '%s'; echo '%s:%s' | chpasswd " % - (username, password, username, password)) + bash("useradd -s '%s' '%s'; echo '%s'; echo '%s:%s' | chpasswd " % + (os.path.join(BASE_DIR, 'init.sh'), username, password, username, password)) if ssh_key_login_need: gen_ssh_key(username, ssh_key_pwd)