How to create a ssh tunnel using python and paramiko?

后端 未结 5 706
攒了一身酷
攒了一身酷 2020-12-02 13:13

I\'m learning python. I need to tunnel creators to read information from a database and close the tunnel. I use paramiko but I have not worked with tonelem example. please g

5条回答
  •  遥遥无期
    2020-12-02 14:14

    Might I suggest trying something like pyngrok to programmatically manage an ngrok tunnel for you? Full disclosure, I am the developer of it. SSH example here, but it's as easy as installing pyngrok:

    pip install pyngrok
    

    and using it:

    from pyngrok import ngrok
    
    #  "localhost:22">
    ssh_tunnel = ngrok.connect(22, "tcp")
    

提交回复
热议问题