Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-29-2010, 08:26 AM
|
#1
|
LQ Newbie
Registered: Dec 2007
Posts: 5
Rep:
|
Reverse SSH tunnel connection problem
I am using a reverse ssh tunnel. However, sometimes the connection is broken but the server continues to think the connection is alive and well. When I try to connect to the server again I get the error:
Warning: remote port forwarding failed for listen port 2000
Issuing the following commands does NOT fix the problem:
service sshd restart
killall sshd
The only thing I have found that clears the problem and allows the client to connect is to reboot the Linux server. Can someone tell me what I am missing? My itty bitty brain can't understand why restarting the sshd service shouldn't fix the problem.
Thank you.
|
|
|
11-29-2010, 09:42 AM
|
#2
|
Member
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661
Rep:
|
Can you share sshd configuration ?. May be it give more broad idea.
Thanks
|
|
|
11-29-2010, 10:27 AM
|
#3
|
LQ Newbie
Registered: Dec 2007
Posts: 5
Original Poster
Rep:
|
sshd config
I posted the sshd config below.
sshd config:
Code:
# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.
Port 22222
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768
# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
RSAAuthentication yes
#PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes
# Accept locale-related environment variables
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
#AllowTcpForwarding yes
#GatewayPorts no
GatewayPorts clientspecified
#X11Forwarding no
X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
ClientAliveInterval 15
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none
# no default banner path
#Banner /some/path
# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server
AllowUsers root surv1 jim
|
|
|
11-29-2010, 12:29 PM
|
#4
|
LQ Newbie
Registered: Oct 2010
Location: Madrid - Spain
Distribution: RHEL
Posts: 26
Rep: 
|
Hi,
Even if you restart sshd daemon, active connections will not drop.
Whenever the problem happens, check with ps if the sshd session is still there and kill it.
Also lsof could help to find out which process has the port opened.
best regards
jose
|
|
|
11-29-2010, 07:19 PM
|
#5
|
LQ Newbie
Registered: Dec 2007
Posts: 5
Original Poster
Rep:
|
Thank you. I can work with that. It doesn't happen very often anymore since I added the ClientAliveInterval but it will be a great help.
Jim
|
|
|
12-01-2010, 09:56 AM
|
#6
|
LQ Newbie
Registered: Dec 2007
Posts: 5
Original Poster
Rep:
|
Quote:
Originally Posted by jlcasado
Hi,
Even if you restart sshd daemon, active connections will not drop.
Whenever the problem happens, check with ps if the sshd session is still there and kill it.
Also lsof could help to find out which process has the port opened.
best regards
jose
|
It does not show up on ps list. The only items that ps showed associated with ssh were my existing login session and the main sshd process. I killed all of them which didn't fix the problem.
Using netstat -an I noticed the connection was in the closed_wait state.
|
|
|
12-01-2010, 03:16 PM
|
#7
|
LQ Newbie
Registered: Oct 2010
Location: Madrid - Spain
Distribution: RHEL
Posts: 26
Rep: 
|
Hi,
Good idea to check the socket state
Unfortunately I don't know a way to close that socket once in this state...maybe it is time to move this to the networking part of the forum....
best regards
jose
|
|
|
All times are GMT -5. The time now is 09:11 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|