Ubuntu – PTY allocation request failed on channel 0

sshUbuntuubuntu-11.04

I recently ran into the following problem when trying to ssh into my Ubuntu 11.04 server:

ssh greg@site.com
PTY allocation request failed on channel 0

I don't know for sure, but I think this happened after one of the latest Ubuntu updates I installed. In case it's of relevance, I'm remoting in from Terminal (Mac OS X 10.7 – Lion).

EDIT: It turns out that I can remote in as another user (i.e. matt) on my server… seems to me like that would point to SSH key problems. If I remote in from another account on the same client machine, it works fine for all users on the server.

SOLUTION:
Turns out that I had gitolite configurations in my ~/.ssh/allowedkeys on the server side. I accidentally ran a configuration script some time ago as my user instead of as the git user. This was kicking off configurations upon remote (keys matched up) that disabled needed settings (see below). I removed the relevant fields from allowedkeys, and I was golden.

debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
PTY allocation request failed on channel 0

Best Answer

It appears like the server operator has adjusted the sshd configuration or setup options in the authroized_keys files to prevent you from getting an interactive shell. Server operators that want to provide sftp access only frequently do this.

debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.

Try connecting without using your keys for authentication. If you can get a shell when you don't use a key the problem is in your authorized_keys file. If you cannot login when trying to use password authentication, and password authentication isn't disabled, then the problem is going to be in the sshd_config.