diff --git a/connect.py b/connect.py index 4627fc461..cec2ea05c 100755 --- a/connect.py +++ b/connect.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # coding: utf-8 import sys diff --git a/install/next.py b/install/next.py index 62814ee67..a68eb66bc 100755 --- a/install/next.py +++ b/install/next.py @@ -81,9 +81,9 @@ class Setup(object): os.system('id %s &> /dev/null || useradd %s' % (self.admin_user, self.admin_user)) @staticmethod - def _cp_zzsh(): - os.chdir(os.path.join(jms_dir, 'install')) - shutil.copy('zzjumpserver.sh', '/etc/profile.d/') + def _ensure_sh(): + jshell = os.path.join(jms_dir, 'connect.py') + os.chmod(jshell, 0755) @staticmethod def _run_service(): @@ -97,7 +97,7 @@ class Setup(object): self._sync_db() self._input_admin() self._create_admin() - self._cp_zzsh() + self._ensure_sh() self._run_service() diff --git a/install/zzjumpserver.sh b/install/zzjumpserver.sh deleted file mode 100755 index 98598ff18..000000000 --- a/install/zzjumpserver.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -if [ "$USER" == "admin" ] || [ "$USER" == "root" ] || [ "$USER" == "" ];then - echo "" -else - 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 312068907..d336d6162 100644 --- a/juser/user_api.py +++ b/juser/user_api.py @@ -151,7 +151,7 @@ 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' | passwd --stdin '%s'" % (username, password, password, username)) + bash("useradd -s /opt/jumpserver/connect.py '%s'; echo '%s'; echo '%s' | passwd --stdin '%s'" % (username, password, password, username)) if ssh_key_login_need: gen_ssh_key(username, ssh_key_pwd)