Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH session being killed randomly #299

Closed
michaeljs1990 opened this issue Apr 19, 2016 · 3 comments
Closed

SSH session being killed randomly #299

michaeljs1990 opened this issue Apr 19, 2016 · 3 comments

Comments

@michaeljs1990
Copy link

michaeljs1990 commented Apr 19, 2016

I imagine this has something to do with docker's init system not functioning properly however when I ssh into a system using this image as root everything is fine and works as expected. If i create another user on the image (since running some commands for my application fail if root runs them) and setting that user up I can log into the system with ssh fine but then get the following errors shortly after logging in.

This is what it looks like from the client side

schuettm@schuettm-m4800:~$ ssh 172.17.0.2 -l non_root_user
Warning: Permanently added '172.17.0.2' (ECDSA) to the list of known hosts.
Last login: Tue Apr 19 21:11:46 2016 from 172.17.0.1
$ Connection to 172.17.0.2 closed.

This is what the logs looks like on the server

debug2: channel 0: gc: user detached
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: server-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 server-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

Received disconnect from 172.17.0.1: 11: disconnected by user
debug1: do_cleanup
debug3: session_unused: session id 0 unused
debug3: mm_request_receive entering
debug1: do_cleanup
debug1: audit_event: unhandled event 12

Nothing else is indicated it just suddenly closes the connection. Been trying to figure this out for a while was hoping you might have some insight.

@michaeljs1990
Copy link
Author

Shortly after this i realized i was just being a complete idiot and forgot to set a login shell. After doing so everything works fine except that if a non root user logs in and then exits a defunct sshd session is left behind.

@michaeljs1990
Copy link
Author

michaeljs1990 commented Apr 20, 2016

I imagine this will become problematic as this service has ~200+ connection a day made to it.

sudo-+-my_init---runsvdir-+-runsv---iceccd
     |                    |-runsv---sshd-+-sshd---bash---pstree
     |                    |              
     |                    |-runsv---cron
     |                    `-runsv---syslog-ng
     `-2*[ssh]

is what my process looks like. I'm not sure of the specifics of why although sshd is started via runsv the ssh connection for a non root user is not started as a child of it.

@FooBarWidget
Copy link
Member

You're not supposed to run my_init with sudo. my_init must be PID 1, otherwise it can't cleanup zombie/defunct processes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants