-3

I have made below changes to /etc/limits file for limiting the number of logins for a particular user from ssh.

rajan L2

rajan is username here.

After making these changes I logged out from session and logged in again so that effect of change should take place.

But can still log in through more 2 than shell using ssh protocol.

I also has tried setting maxsession 2 in /etc/ssh/sshd_config but didn't work out.

Can any body tell me what I am doing wrong?

Edit: I want maximum number of simultaneous SSH sessions to 5.

Ladadadada
  • 26,337
  • 7
  • 59
  • 90
Rajan Pathak
  • 1
  • 1
  • 3

1 Answers1

2

The MaxSession option in sshd_config is for the number of simultaneous sessions per connection, not the total number of connections.

I'd recommend using the PAM module pam_limits instead. On the CentOS server I happen to have handy, you would edit /etc/security/limits.conf to contain the line

rajan - maxlogins 2

to limit Rajan to two simultaneous logins. There's more information in man limits.conf.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
  • I don't have pam.d installed on my machine and can't see /etc/security/limits.conf on my box.I have /etc/securetty on my box. – Rajan Pathak Dec 10 '13 at 10:46