4

Is there a way to run sshd such that it can (at least for a limited number of log-ins) successfully return a prompt (likely busybox) even while fork is unavailable (e.g. out of PIDs)?

It seems to me this should be possible by, for example, the sshd pre-forking and keeping a pool of gettys to use to service log in requests.

BCS
  • 75,627
  • 68
  • 187
  • 294
  • Actually, I don't know... But can you tell us why you want to do this? This may provide some hints eventual answers... : ) – Macmade Dec 06 '11 at 21:20
  • @Macmade It's quite legitimate. Suppose the box is overloaded and you want to SSH to it but you can't because `fork` fails. – cnicutar Dec 06 '11 at 21:22
  • @Macmade: cnicutar got it in one. – BCS Dec 06 '11 at 21:35

1 Answers1

2

SSHD can be launched with the -D or -d option.

-D:

When this option is specified, sshd will not detach and does not become a daemon.
This allows easy monitoring of sshd.

-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. This option is only intended for debugging for the server.
Multiple -d options increase the debugging level. Maximum is 3.

I guess your best choice is to run a separate SSHD process, listening on another port, with the -d option.

So when the «normal» SSHD fails, you will still be able to switch to the other one, using the alternate port.

Macmade
  • 52,708
  • 13
  • 106
  • 123