ssh connection via alternate port closed immediately after logging in
I am having the following issue. I can successfully ssh into my Mac using the default port (22). However, when I try connecting using a different port (e.g. 1234) as soon as I log in (after entering my password) the connection is closed.
The only way I am able to get sshd to listen on an alternate port is to issue the sudo /usr/sbin/sshd -p [port] command—editing /etc/sshd_config was futile, as well as any attempts to port forward using ipfw. So once I issue that command, I can type ssh username@localip -p 1234
I believe at one point I had been able to establish an ssh connection via the alternate port, but I probably messed something up when playing around with the config files. I kept backup copies of config files (e.g. sshd_config) so all defaults should be restored and file permissions should be correct. I've tried disabling PAM authentication but have been able to since editing sshd_config doesn't seem to affect or change anything.
Any help with getting this working will be greatly appreciated. If not, what would be the best way to reinstall the ssh daemon on Leopard?
Following is an excerpt of my secure.log and system.log when attempting to ssh via the alternate port:
secure.log:
Jun 24 22:28:24 Macintosh sshd[9677]: Accepted keyboard-interactive/pam for felipe from 10.0.1.199 port 56204 ssh2
Jun 24 22:28:24 Macintosh sshd[9682]: error: PAM: pam opensession(): Cannot make/remove an entry for the specified session
system.log:
Jun 24 22:28:24 Macintosh com.apple.launchd[1] (com.apple.launchd.peruser.501[107]): Root Mach bootstrap cannot be transferred.
Jun 24 22:28:24 Macintosh com.apple.launchd[107] (0x10de00.sshd[9682]): Bug: launchd corelogic.c:6244 (23585):1100: kr == 0
Jun 24 22:28:24 Macintosh sshd[9677]: USER_PROCESS: 9682 ttys002
Jun 24 22:28:24 Macintosh sshd[9677]: DEAD_PROCESS: 9682 ttys002
And below is a transcript of an ssh connection in triple verbose mode (-vvv) after the password has been input (I've bolded where I believe the issue starts):
debug2: input userauth_inforeq: num_prompts 1
Password:
debug3: packet_send2: adding 32 (len 24 padlen 8 extra_pad 64)
debug2: input userauth_inforeq
debug2: input userauth_inforeq: num_prompts 0
debug3: packet_send2: adding 48 (len 10 padlen 6 extra_pad 64)
debug1: Authentication succeeded (keyboard-interactive).
debug1: channel 0: new [client-session]
debug3: ssh session2open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client session2setup: id 0
debug2: channel 0: request pty-req confirm 0
debug3: tty makemodes: ospeed 9600
debug3: tty makemodes: ispeed 9600
debug3: tty makemodes: 1 3
debug3: tty makemodes: 2 28
debug3: tty makemodes: 3 127
debug3: tty makemodes: 4 21
debug3: tty makemodes: 5 4
debug3: tty makemodes: 6 255
debug3: tty makemodes: 7 255
debug3: tty makemodes: 8 17
debug3: tty makemodes: 9 19
debug3: tty makemodes: 10 26
debug3: tty makemodes: 11 25
debug3: tty makemodes: 12 18
debug3: tty makemodes: 13 23
debug3: tty makemodes: 14 22
debug3: tty makemodes: 17 20
debug3: tty makemodes: 18 15
debug3: tty makemodes: 30 0
debug3: tty makemodes: 31 0
debug3: tty makemodes: 32 0
debug3: tty makemodes: 33 0
debug3: tty makemodes: 34 0
debug3: tty makemodes: 35 0
debug3: tty makemodes: 36 1
debug3: tty makemodes: 38 1
debug3: tty makemodes: 39 1
debug3: tty makemodes: 40 0
debug3: tty makemodes: 41 1
debug3: tty makemodes: 50 1
debug3: tty makemodes: 51 1
debug3: tty makemodes: 53 1
debug3: tty makemodes: 54 1
debug3: tty makemodes: 55 0
debug3: tty makemodes: 56 0
debug3: tty makemodes: 57 0
debug3: tty makemodes: 58 0
debug3: tty makemodes: 59 1
debug3: tty makemodes: 60 1
debug3: tty makemodes: 61 1
debug3: tty makemodes: 62 1
debug3: tty makemodes: 70 1
debug3: tty makemodes: 72 1
debug3: tty makemodes: 73 0
debug3: tty makemodes: 74 0
debug3: tty makemodes: 75 0
debug3: tty makemodes: 90 1
debug3: tty makemodes: 91 1
debug3: tty makemodes: 92 0
debug3: tty makemodes: 93 0
debug2: channel 0: request shell confirm 0
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
Last login: Tue Jun 24 23:24:20 2008 from 10.0.1.199
*debug2: channel 0: rcvd eof*
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug1: client input_channelreq: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cfd -1)
debug3: channel 0: close_fds r -1 w -1 e 6 c -1
Connection to 10.0.1.199 closed.
debug1: Transferred: stdin 0, stdout 0, stderr 34 bytes in 0.0 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 2902.8
debug1: Exit status 254
iMac 6.1, Mac OS X (10.5.3)