Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: How do you use Net::OpenSSH to query mysql database via ssh tunnel

by haukex (Archbishop)
on May 09, 2017 at 18:52 UTC ( [id://1189938]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How do you use Net::OpenSSH to query mysql database via ssh tunnel
in thread How do you use Net::OpenSSH to query mysql database via ssh tunnel

Thanks! If I understand correctly, with this command, the tunnel just stays open as long as the master process is running?

Revised code:

use Net::OpenSSH; my $ssh = Net::OpenSSH->new($host); die $ssh->error if $ssh->error; $ssh->system({ssh_opts => ['-O','forward', '-L127.0.0.1:12345:127.0.0.1:3306' ] }) or die $ssh->error;
  • Comment on Re^3: How do you use Net::OpenSSH to query mysql database via ssh tunnel
  • Download Code

Replies are listed 'Best First'.
Re^4: How do you use Net::OpenSSH to query mysql database via ssh tunnel
by salva (Canon) on May 10, 2017 at 06:53 UTC
    Yes, it will stay open until the master process finishes or you ask it to close the tunnel sending a cancel control:
    $ssh->system({ssh_opts => ['-O', 'cancel', '-L127.0.0.1:12345:127.0.0. +1:3306']});

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1189938]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found