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

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 [email protected] -p 1234
[email protected]'s password:
  • Client 2
> ssh [email protected] -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)?

Unix & Linux Asked by inkychris on November 11, 2021

2 Answers

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]:

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!

Related Questions

query regarding puppet stdlib module

0  Asked on January 16, 2021 by rajnish-kumar-soni


Bash – Running a bash script from within a ksh script

1  Asked on January 16, 2021 by mo12


Pop OS doesn’t boot up because of pci-e bus error

1  Asked on January 16, 2021 by user6516763


How do I reformat a hybrid-mbr sd card?

0  Asked on January 12, 2021 by dave-mankoff


bash Noob: What’s wrong with this line?

1  Asked on January 12, 2021 by ottoeisen


How can I save the last command to a file?

4  Asked on January 12, 2021 by mattlbeck


Sourcing /root/.zshrc in Docker using current user

3  Asked on January 9, 2021 by mihai-galos


Sed command writes the expression in outer ifmodule

1  Asked on January 9, 2021 by ariana-williams


Netctl is slow in arch linux

1  Asked on January 9, 2021 by fenil-shah


Ask a Question

Get help from others!

© 2021 All rights reserved.