Dear all,
I try to create an SSH tunnel from my local PC to the remote mysql server. I use the standard ssh command:
ssh -N -L 3333:127.0.0.1:3306 user@remotehost
The authentication is handled by keychain, so no issue.
However, the problem exists as soon as ssh is authenticated.
Specifically, I receive a "listen: Bad file descriptor" message right after the authentication.
SSH seems to have generate the tunnel, however, the "netstat -pant" reveals that the local port 3333 is not listening!
Code:
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 3008/rsyncd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3120/mysqld
tcp 0 0 127.0.0.1:38094 0.0.0.0:* LISTEN 8945/gdl_indexer
tcp 0 0 127.0.0.1:38094 127.0.0.1:55421 SYN_RECV -
tcp 0 0 127.0.0.1:38094 127.0.0.1:60912 SYN_RECV -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2788/portmap
tcp 0 0 127.0.0.1:2544 0.0.0.0:* LISTEN 2923/zmd
tcp 0 0 0.0.0.0:631 0.0.0.0:* LISTEN 2946/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3250/master
tcp 223 0 127.0.0.1:38094 127.0.0.1:49024 ESTABLISHED -
tcp 0 0 ::1:3333 :::* LISTEN 10537/ssh
ssh -v does not reveal a problem with the remote server:
Code:
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/tpe/.ssh/identity
debug1: Trying private key: /home/tpe/.ssh/id_rsa
debug1: Trying private key: /home/tpe/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentication succeeded (keyboard-interactive).
debug1: Local connections to LOCALHOST:3333 forwarded to remote address 127.0.0.1:3306
debug1: Local forwarding listening on 127.0.0.1 port 3333.
listen: Bad file descriptor
debug1: Local forwarding listening on ::1 port 3333.
debug1: channel 0: new [port listener]
debug1: Entering interactive session
So, I thought that the problem was in my host file. However, the hosts file was simple and seems to be OK.
Code:
127.0.0.1 localhost
127.0.0.1 mysql.local
127.0.0.1 kde.linux kde
So, I checked the local sshd_config file:
Code:
PasswordAuthentication no
UsePAM yes
AllowTcpForwarding yes
X11Forwarding yes
TCPKeepAlive yes
Subsystem sftp /usr/lib/ssh/sftp-server
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
But that seems to be OK too.
So, now I am scratching my head for a solution. Could someone help me please?