mirror of https://github.com/jumpserver/jumpserver
set PS1
parent
988991a0ad
commit
8baff2c72d
|
@ -106,6 +106,8 @@ def connect(username, password, host, port):
|
|||
Connect server.
|
||||
"""
|
||||
|
||||
ps1 = '[\u@%s \W]\$' % host
|
||||
|
||||
# Make a ssh connection
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.load_system_host_keys()
|
||||
|
@ -120,9 +122,15 @@ def connect(username, password, host, port):
|
|||
except:
|
||||
pass
|
||||
|
||||
# Modify PS1
|
||||
channel.send('PS1=%s' % ps1)
|
||||
|
||||
# Make ssh interactive tunnel
|
||||
posix_shell(channel, username, host)
|
||||
|
||||
# shutdown channel socket
|
||||
channel.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
connect('guanghongwei', 'Lov@j1ax1n', '172.16.1.122', 2001)
|
||||
|
|
Loading…
Reference in New Issue