PythonSSH |
PythonSSH | PythonSSH 1 2 3 4 5 6 7 8 9 10 11 12 13 from sshtunnel import SSHTunnelForwarder def get_ssh_tunnel (): server = SSHTunnelForwarder( ssh_address_or_host=( '192.168.1.2' , 22 ), ssh_username= 'username' , ssh_password= 'ssh-password' , remote_bind_address=( '10.16.3.3' , 3306 ), local_bind_address=( '0.0.0.0' , 3306 ) ) server.start() return server : ssh_address_or_host : IP Port ssh_username : ssh_password : remote_bind_address : IP(, 127.0.0.1) Port local_bind_address : SSH IP( 0.0.0.0 IP,) Port ssh /etc/ssh/sshd_config AllowTcpForwarding yes https://blog.csdn.net/fengbohello/article/details/121181959 https://blog.csdn.net/qq_45373631/article/details/121805726 0% Theme NexT works best with JavaScript enabled
PythonSSH 12345678910111213from sshtunnel import SSHTunnelForwarder def get_ssh_tunnel(): server = SSHTunnelForwarder( ssh_address_or_host=(&#x27;192.168.1.2&#x27;, 22),