Cannot login to ssh after installing Gitolite? PTY allocation request failed on channel 0

5,917
error: PTY allocation request failed on channel 0

Perfectly normal, expected, and not blocking (ie the ssh operation would pursue)

However, you did the installation as root, which is bad, especially when you consider the ssh Gitolite page:

If you're installing gitolite, you're a "system admin", like it or not.
If you're using the default ssh mode (i.e., not http mode), ssh is a necessary skill. Please take the time to learn at least enough to get passwordless access working.

The key aspect to understand in Gitolite is its usage of forced command, in order to deny interactive shell and to intercept any command (including the git commands), allowing it to enforce access control to Git repos.

That means your ~root/.ssh/authorized_keys file contains line with:

command="/devit_home/users/vobadm/gitpoc/ce7/gitolite/bin/gitolite-shell gitoliteadm",no-port-forwarding,no-X11-for        warding,no-agent-forwarding,no-pty ssh-rsa AAAAB3N

The no-port-forwarding is responsible for that warning message "PTY allocation request failed on channel 0". But that doesn't prevent Gitolite operations to run properly.

See "how does gitolite use all this ssh magic?".

For ssh issue, look into "SSH troubleshooting".
You need to gain access to your server by another way than ssh, and remove the line beginning by command in ~root/.ssh/authorized_keys.


Do you know how I might use Telnet to redo the gitolite installation process?

Once logged as root:

  • remove the line beginning by command in the ~root/.ssh/authorized_keys file.
  • make sure your root public key is registered in that same file (so without any 'command=' in front of it.

That will ensure a root access through ss.

Then redo the installation, but with a sudo git first.
you must be 'git' when doing that installation.

You must first generate on the client side an git private ssh key and a git.pub public key.
Copy the public key on the server: you will pass that public key to the gitolite install command.

And as Ryan mentions in his answer, uses

DiskStation> /volume1/homes/git/gitolite/install -ln

(in order to link the installation to ~git/bin instead of the "system path root-protected" /bin directory).

Share:
5,917
Jay
Author by

Jay

Software Developer (Web), Designer, Painter, Photographer, Foodie, Dog lover.

Updated on September 18, 2022

Comments

  • Jay
    Jay over 1 year

    After I installed Gitolite onto my Synology DiskStation NAS as per these instructions: http://www.bluevariant.com/2012/05/comprehensive-guide-git-gitolite-synology-diskstation/

    I realized that I managed to install gitolite, but for whatever reason I was not able to run the installation using the user "git" - but I was able to do so as "root"

    After installing, I logged out. But now every time I tried to login via ssh again: $ ssh root@iptonas

    I got this error: PTY allocation request failed on channel 0

    I read somewhere that gitolite disables ssh logins now? How else can I get back into shell..?

  • Jay
    Jay almost 12 years
    Thank you! That clarifies things a bit. But what do you mean exactly by 'it's bad that I installed via root'? What are the ramifications? And is there a way to take a step back and redo it properly?
  • VonC
    VonC almost 12 years
    @Jay The inconvenience of a root installation is the possibility to lock oneself out of the server (is ssh access is all you have). You can simply repeat the installation process, but this time with a 'sudo git' first.
  • Jay
    Jay almost 12 years
    Well, the other option is Telnet, but I have no idea what that is. So yeah, I think I've locked myself out. Is there a way to undo that?
  • VonC
    VonC almost 12 years
    @Jay no way that I know of, but explorer that telnet option (it is a service like ssh except without encryption). Try a telnet @ip_of_your_server and see if you can connect that way.
  • Jay
    Jay almost 12 years
    Ok, I'm able to login via Telnet it looks like. Do you know how I might use Telnet to redo the gitolite installation process? Thank you very much for all your help!!
  • VonC
    VonC almost 12 years
    @Jay: answer edited