SSH Disconnecting: Bad packet length

If I log into my new Xserves (running 10.4.4) using an invalid username, after I submit a password, ssh will hang for a long time then report:
Disconnecting: Bad packet length xxxxxx

My older Xserves (running 10.2 and 10.3) don't have this problem, they will just say "Permission denied, please try again" and prompt for the password again. eventually they'll disconnect you, but not with an error.

Has Apple supplied a new version of SSH in 10.4 that is broken in some way?

I have noticed this on both OS X server, and the desktop version (All at 10.4.4)

This doesn't seem to be a problem if you use a valid login, only when you use an invalid userid.

Any one else run into this? Any idea how to make ssh behave?

thanks

-jason

Dual 2ghz G5, 1ghz 17" powerbook, 1.2ghz mini, Mac OS X (10.4.4)

Posted on Jan 29, 2006 10:14 AM

Reply
5 replies

Feb 3, 2006 1:08 PM in response to Essington

I've seen such behaviour with unreliable connections. Are you connecting over some dial-up connection? It might also be an ISP or Router that disconnects after a certain idle period without traffic.

I could resolve my issue by adding -o ServerAliveInterval 60 to my ssh connections. (I usually use them via ~/.ssh/config for comfort) You may also try the TCPKeepAlive option.

If that doesn't help, tell us some more details about the way you connect.
MacLemon

Feb 3, 2006 8:47 PM in response to MacLemon

In this case I was attempting to connect via my laptop (a powerbook) that was connected to the servers via a gigabit switch (the only intervening piece of equipment). Needless to say, these are about the most reliable connections you could expect to have.

However, I've seen this behavior, when connecting to:
2 different Xserves running 10.4.4 Server
1 DualG5 powermac running 10.4.4 and
1 Powerbook also running 10.4.4
However when connecting to 10.2.x or 10.3.x servers, I receive the Permission denied response as one would expect.

I just had an epiphany ....

While attempting to disable password authentication on the 2 xserves altogether, I had to set not only "PasswordAuthentication no", but also "UsePAM no".

So, perhaps the problem is that UsePAM is set to yes by default....

I just attempted to log in to my workstation (10.4.4 with an unmodified sshd_config file) using a bogus username and I received:
"Disconnecting: Bad packet length 4185019582" after an extended delay
Then I changed the config file to set "UsePAM no" and tried the login again. this time I received:
"Permission denied, please try again." almost immediately
So, It appears that the default configuration that has PAM enabled for sshd is the problem here.

Thanks for having me revisit this after sitting on it for a couple of days. It led me to the solution.

-jason

Feb 5, 2006 6:23 PM in response to Essington

I followed this thread but couldn't see a resloution for my variation. from a 10.4.4 server (A) logged in as root, I can ssh admin@... sucessfully to my other 10.4.4 server (B), but when I ssh root@... after I enter the password there is a pause and then I get the Disconnecting: Bad Packet Length error.

I can ssh from B to A using both root and admin.

Any ideas? I tried the UsePam change but then I couldn't ssh at all.

Alan

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

SSH Disconnecting: Bad packet length

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.