TransWikia.com

Can sshd be configured to support multiple connections when running standalone?

Unix & Linux Asked by inkychris on November 11, 2021

I’m trying to create an SSH server Docker image that can establish multiple concurrent connections:

  • Server
> sudo /usr/sbin/sshd -Ddp 1234
  • Client 1
> ssh user@server -p 1234
user@server's password:
...
  • Client 2
> ssh user@server -p 1234
ssh: connect to host server port 1234: Connection refused

The same server machine which has an ssh-server daemon run by systemd does allow for multiple connections.

Is there a way to configure sshd to run standalone, ie. not with a service manager like systemd, or is sshd fundamentally only meant to handle a single connection and the concurrency comes from it being managed? If so, what is systemd doing to allow for concurrent connections if it’s only told ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (doesn’t look like SSHD_OPTS is being set anywhere)?

2 Answers

Debugging sshd over multiple connections can be achieved using the following.

/usr/sbin/sshd -o LogLevel=DEBUG3 -De

Answered by Derek Gorczynski on November 11, 2021

I think -d gets in the way. From man 8 sshd:

sshd listens for connections from clients. […] It forks a new daemon for each incoming connection. […]

And later [emphasis mine]:

-d
Debug mode. The server sends verbose debug output to standard error, and does not put itself in the background. The server also will not fork and will only process one connection. […]

My tests indicate sshd -d behaves like you described. When I run it without -d it is able to handle multiple connections just fine.

Answered by Kamil Maciorowski on November 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP