0

I got a server with enabled ssh. To prevent attacks and to fit to my needs, I just need one connection at the same time to my server. So, I tried to set MaxSessions paramater to 1 in /etc/ssh/sshd_config, restartet the daemon and it does not take effect. My server uses openSUSE 13.2

  • Limiting the number of connections to 1 will not prevent attacks. It will, however, sometimes cause a denial of service: when you get disconnected by a client crash or network glitch, you won't be able to log back in until the server has timed out. Don't do this. – Gilles 'SO- stop being evil' Mar 16 '15 at 22:34
1

The MaxSessions parameter limits the number of multiplexed sessions you have on a single ssh session.

Session multiplexing allows to setup a single Master connection which all other connections to the same host can then reuse. This has no effect on the ability to connect again to the same host via a new network connection.

SSH has no way to limit or control multiple connections coming from different IP addresses.

You will need to use /etc/security/limits.conf so each user is limited to 1 session. Something like this:

userid  - maxlogins  1
  • OP probably wants to set maxlogins in limits.conf – Bratchley Mar 16 '15 at 13:09
  • do I need to restart a daemon then? – alpham8 Mar 16 '15 at 21:37
  • No. Active sessions will use old values. Doing a log out and back in take effect of the limits change. – jcbermu Mar 17 '15 at 9:46
  • Thanks. Helped me a lot. The most possible that can I do in that case. – alpham8 Mar 17 '15 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.