I’m trying to create an SSH server Docker image that can establish multiple concurrent connections:
> sudo /usr/sbin/sshd -Ddp 1234
> ssh [email protected] -p 1234 [email protected]'s password: ...
> 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)?
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
-d gets in the way. From
man 8 sshd:
sshdlistens 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
1 Asked on January 16, 2021 by mo12
0 Asked on January 16, 2021 by wesh
1 Asked on January 16, 2021 by user6516763
1 Asked on January 15, 2021
1 Asked on January 13, 2021 by hidden
1 Asked on January 12, 2021 by n0542344
4 Asked on January 12, 2021 by mattlbeck
3 Asked on January 11, 2021 by seb
1 Asked on January 10, 2021 by aboleth
3 Asked on January 9, 2021 by mihai-galos
1 Asked on January 9, 2021 by ariana-williams
1 Asked on January 9, 2021 by fenil-shah
4 Asked on January 8, 2021
1 Asked on January 8, 2021 by pieterkeesdejong
3 Asked on January 8, 2021 by user2039379
2 Asked on January 7, 2021 by brykkan
Get help from others!