Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made a stupid mistake. I have a small vhosted CentOS server and I was configuring git+gitosis when i think I ran the gitosis ssh key init on my own user in addition to the git user. I didn't realize it at the time but now when i try to ssh to the server with my user i get:

TY allocation request failed on channel 0
ERROR:gitosis.serve.main:Need SSH_ORIGINAL_COMMAND in environment.
Connection to [servernamehere] closed.

Any idea how I can login to the server again? Unfortunately i have disabled ssh root login. Thanks!

A more complete log (relevant part):

debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug2: channel 0: request shell confirm 1
debug2: fd 3 setting TCP_NODELAY
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
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
debug2: channel 0: rcvd ext data 67
ERROR:gitosis.serve.main:Need SSH_ORIGINAL_COMMAND in environment.
debug2: channel 0: written 67 to efd 7
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_channel_req: 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 7 c -1
Connection to myserver closed.
share|improve this question
Who are you hosted with? Most hosts of virtual machines allow console access using their administration panel. – dannymcc Jun 30 '11 at 8:51
@dannymcc Unfortunately my provider does not. They might do it internally if I contact their support. I was asking to see if there's an easy solution as it seems that the connection is established (via publickey) but then killed by gitosis. – Cristian Vrabie Jun 30 '11 at 8:59
Is the connection killed as soon as you run a git command? – dannymcc Jun 30 '11 at 9:13
@dannymcc i don't run any git command. git works fine on the git@server, but when i try to simply connect to myuser@server that's when it gets disconnected. if i run ssh -v -v -v myuser@server i see the log that i just added in description. – Cristian Vrabie Jun 30 '11 at 10:20
up vote 0 down vote accepted

Sorry Cristian no easy answer to this, your user can only interact with git.

share|improve this answer
Yup. Seems you're right. Fortunately the vps provider was kind enough to reset my sshd config file to allow root login. Any idea what i must do to remove the gitosis hook? – Cristian Vrabie Jun 30 '11 at 11:27
Found the solution. You need to edit .ssh/authorized_keys to remove the command added by gitosis to auto-execute on ssh login. – Cristian Vrabie Jun 30 '11 at 11:43
Ah congrats on regaining control ;) – SuperBOB Jun 30 '11 at 12:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.