LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-25-2015, 05:24 PM   #1
XDimensioN
Member
 
Registered: Dec 2013
Posts: 34

Rep: Reputation: Disabled
Connection to MySQL through SSH tunnel


Hi

I tried to connect to MySQL through SSH tunnel by using JSCH library, but the procedure has failed. The MySQL server is installed in Ubuntu Server and the server machine is behind a D-Link router. I enabled debug logging of SSH server (auth.log) and this is how I got:

Code:
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: SELinux support disabled
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: PAM: establishing credentials
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: permanently_set_uid: 1000/1000
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: packet_set_postauth: called
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: Entering interactive session for SSH2.
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: server_init_dispatch_20
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: server_input_channel_open: ctype direct-tcpip rchan 0 win 131072 max 16384
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: server_request_direct_tcpip: originator 127.0.0.1 port 53656, target 127.0.0.1 port 3306
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: connect_next: host 127.0.0.1 ([127.0.0.1]:3306) in progress, fd=17
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: channel 0: new [direct-tcpip]
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: server_input_channel_open: confirm direct-tcpip
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: channel 0: connection failed: Connection refused
Sep 25 18:01:04 ubuntu-server sshd[13462]: debug1: channel 0: free: direct-tcpip, nchannels 1
I don't really know what is the cause of connection refuse. I even used tcpdump command to check if MySQL server receives the messages, this is what I got:

Code:
sudo tcpdump -i any 'port 3306' -v -XX
tcpdump: listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
18:20:19.744144 IP (tos 0x0, ttl 64, id 1650, offset 0, flags [DF], proto TCP (6), length 60)
    localhost.35978 > localhost.mysql: Flags [S], cksum 0xfe30 (incorrect -> 0x18aa), seq 1510133585, win 43690, options [mss 65495,sackOK,TS val 10144035 ecr 0,nop,wscale 6], length 0
        0x0000:  0000 0304 0006 0000 0000 0000 0000 0800  ................
        0x0010:  4500 003c 0672 4000 4006 3648 7f00 0001  E..<.r@.@.6H....
        0x0020:  7f00 0001 8c8a 0cea 5a02 cf51 0000 0000  ........Z..Q....
        0x0030:  a002 aaaa fe30 0000 0204 ffd7 0402 080a  .....0..........
        0x0040:  009a c923 0000 0000 0103 0306            ...#........
18:20:19.744199 IP (tos 0x0, ttl 64, id 2120, offset 0, flags [DF], proto TCP (6), length 40)
    localhost.mysql > localhost.35978: Flags [R.], cksum 0xef04 (correct), seq 0, ack 1510133586, win 0, length 0
        0x0000:  0000 0304 0006 0000 0000 0000 0000 0800  ................
        0x0010:  4500 0028 0848 4000 4006 3486 7f00 0001  E..(.H@.@.4.....
        0x0020:  7f00 0001 0cea 8c8a 0000 0000 5a02 cf52  ............Z..R
        0x0030:  5014 0000 ef04 0000                      P.......
Any suggestions is welcome. Thanks in advance.
 
Old 09-26-2015, 02:55 PM   #2
Rinndalir
Member
 
Registered: Sep 2015
Posts: 733

Rep: Reputation: Disabled
What is JSCH?
 
Old 09-27-2015, 11:02 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
Why not just use a std ssh tunnel eg http://blog.trackets.com/2014/05/17/...-examples.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql ssh tunnel trouble jdmmis Linux - Server 4 06-29-2015 10:03 AM
disable SSH Tunnel on MySQL jrahma Linux - Newbie 2 06-22-2014 05:59 AM
MySQL Cannot start SSH tunnel manager?? michaelinux Linux - Software 4 09-20-2012 07:47 AM
Reverse SSH tunnel connection problem orwb Linux - Server 6 12-01-2010 03:16 PM
how can i tunnel all network with ssh connection ? jabka Linux - Security 2 07-06-2007 03:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration