Operating System - HP-UX
1819818 Members
3225 Online
109607 Solutions
New Discussion юеВ

ssh connection immediately gives connection closed.

 
Asya
Regular Advisor

ssh connection immediately gives connection closed.

Hi,

I have a weird problem.

I'm trying to ssh to a box...
Trying to ssh as a root with hostbased authentication, works fine.
Trying to ssh as a user, fails.

This is the error message from the log file:

Jan 30 11:18:22 graphite sshd[2424]: error: close(s->ptymaster/0): Bad file number
Jan 30 11:18:22 graphite sshd[2426]: fatal: mm_receive_fd: recvmsg: expected received 1 got 0

I tried to run sshd on a different port and it works..I'm able to ssh without any problems.

Running in verbose mode gives the following:

debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cfd -1)

debug3: channel 0: close_fds r 5 w 6 e 7 c -1
Connection to graphite closed by remote host.
Connection to graphite closed.
debug1: Transferred: stdin 0, stdout 0, stderr 79 bytes in 0.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 1173.0
debug1: Exit status -1

I checked patches..they are up to date and are the same as on the other server where everything is working properly.

Connecting as a user through ssh client on windows works fine, though takes a while to connect. The problem is connecting from a non-windows client...solaris, hp-ux...

What could be causing it?

Thanks!
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: ssh connection immediately gives connection closed.

Shalom,

Check the syslog on the box you are trying to connect to.

/var/adm/syslog/syslog.log

There may be a networking issue or sshd_config may be configured to block root access.

Also possible is the target system is configured only to permit root console login.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Asya
Regular Advisor

Re: ssh connection immediately gives connection closed.

Steve,

Thanks for the response.

Nothing was changed on the server...It worked 2 weeks ago.

sshd_config was copied from the server where everything is working properly.

I'm accessing it as root not from a console...

Even if one of your suggestions were true, how come it's working from another port?

Thanks again..

Asya
Denver Osborn
Honored Contributor

Re: ssh connection immediately gives connection closed.

When you copied the known good sshd_config over to the problem server, did you restart sshd? If not then it would explain why you were able to connect sshd started up on another port.

-denver
Asya
Regular Advisor

Re: ssh connection immediately gives connection closed.

Yes i did restart sshd.
Denver Osborn
Honored Contributor

Re: ssh connection immediately gives connection closed.

Is this an HP-UX node? If so, what rev of ssh and is it HP's build (Secure_Shell) or one you compile from source?

Is UsePrivilegeSeparation set to yes or no in sshd_config? If it's yes, can you test user logins with it set to no?


-denver
Asya
Regular Advisor

Re: ssh connection immediately gives connection closed.

Denver,

Here it is..

#UsePrivilegeSeparation yes

I've noticed that sometimes ssh succeeds, sometimes doesn't...

if it doesn't, it dies here:

debug2: channel 0: open confirm rwindow 0 rmax 32768
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 4/5)

debug3: channel 0: close_fds r 4 w 5 e 6
Connection to genius closed by remote host.
Connection to genius closed.
debug1: Transferred: stdin 0, stdout 0, stderr 75 bytes in 60.3 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 1.2
debug1: Exit status -1


it hangs for about 30 seconds before giving out this error. Sometimes it doesn't give this error message and work..

Thank you

Denver Osborn
Honored Contributor

Re: ssh connection immediately gives connection closed.

Maybe you're seeing a DNS issue...

Is "UseDNS yes" in sshd_config? If so, do things improve if setting UseDNS to no?

-denver
Asya
Regular Advisor

Re: ssh connection immediately gives connection closed.

Denver,

very weird thing. The problem went away after the reboot. Any idea..?

Thank you!