pull/6/head
guanghongwei 10 years ago
parent 988991a0ad
commit 8baff2c72d

@ -106,6 +106,8 @@ def connect(username, password, host, port):
Connect server. Connect server.
""" """
ps1 = '[\u@%s \W]\$' % host
# Make a ssh connection # Make a ssh connection
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.load_system_host_keys() ssh.load_system_host_keys()
@ -120,9 +122,15 @@ def connect(username, password, host, port):
except: except:
pass pass
# Modify PS1
channel.send('PS1=%s' % ps1)
# Make ssh interactive tunnel # Make ssh interactive tunnel
posix_shell(channel, username, host) posix_shell(channel, username, host)
# shutdown channel socket
channel.shutdown()
if __name__ == '__main__': if __name__ == '__main__':
connect('guanghongwei', 'Lov@j1ax1n', '172.16.1.122', 2001) connect('guanghongwei', 'Lov@j1ax1n', '172.16.1.122', 2001)

Loading…
Cancel
Save