Wednesday, August 23, 2017

mysql - solaris ssh port forward



I have been trying to create a ssh tunnel from a Linux box to a mysql server on a Solaris box with: ssh -i -L 3333:localhost:3306 root@ command on the Linux box.



On trying to connect to the mysql server from the Linux box with command mysql -P 3333 -h 127.0.0.1 -u root -p, I am getting the following error: ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0



Now running the sshd (Solaris) on debug level 3 I get the following error:




debug1: server_input_channel_open: ctype direct-tcpip rchan 3 win 2097152 max 32768
debug1: server_request_direct_tcpip: originator 127.0.0.1 port 34100, target localhost port 3306
Received request to connect to host localhost port 3306, but the request was denied.
debug1: server_input_channel_open: failure direct-tcpip


And also getting the following error: channel 3: open failed: administratively prohibited: open failed



On the Solaris machine:





  • SSH version : Sun_SSH_1.1

  • cat /etc/release : Solaris 10 11/06 s10x_u3wos_10 X86

  • uanme -a : SunOS unknown 5.10 Generic_118855-33 i86pc i386 i86pc



On the Linix box :





  • SSH version : OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010


Answer



Fixed : There was two conflicting AllowTcpForwarding value in the sshd_config. Somehow the first one with value no was taking precedence. Might be a bug with OpenSSH 4.2p1


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...