mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 06:46:24 +00:00
修复 su - 无法获取 Env的bug
This commit is contained in:
@@ -33,7 +33,10 @@ from jperm.ansible_api import MyRunner
|
||||
from jlog.models import ExecLog, FileLog
|
||||
|
||||
login_user = get_object(User, username=getpass.getuser())
|
||||
remote_ip = os.environ.get('SSH_CLIENT').split()[0]
|
||||
try:
|
||||
remote_ip = os.environ.get('SSH_CLIENT').split()[0]
|
||||
except (IndexError, AttributeError):
|
||||
remote_ip = os.popen("who -m | awk '{ print $NF }'").read().strip('()\n')
|
||||
|
||||
try:
|
||||
import termios
|
||||
|
Reference in New Issue
Block a user