Chrooted SSH user can connect, but fails to obtain a pts. Error message: PTY allocation request failed on channel 0

Posted on

Hi gurus,

I've followed the doc https://access.redhat.com/solutions/284873 to chroot a user using the "ChrootDirectory" directive in /etc/ssh/sshd_config.

Everything worked pretty well, except that I get the error message: PTY allocation request failed on channel 0 when I initiate a connection.

It then looks as if the connection was stale (no prompt), but it is not.
The user is actually connected, can launch commands, receive answers, but it cannot come back in the commands' history and the fact that there is no prompt is somewhat disturbing.

Here is the output of the ssh command with option -vvv:

Authenticated to xxx ([xxx.xxx.xxx.xxx]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env HOSTNAME
debug3: Ignored env SHELL
debug3: Ignored env TERM
debug3: Ignored env HISTSIZE
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env PWD
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env HISTCONTROL
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LOGNAME
debug3: Ignored env LESSOPEN
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 100 id 0
PTY allocation request failed on channel 0 <==== Failure
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0

The strange thing is that I did the same on another server which does not experience this issue. I've tried quite hard to find any difference between those servers, but did not find anything so far, except that 2 following lines:

debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0

Any suggestion?

Responses