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

gitgitolitenas

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..?

Best Answer

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).