Commit 8baff2c7 authored by guanghongwei's avatar guanghongwei

set PS1

parent 988991a0
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment