nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

SSH limit number of simultaneous logins attempts for each user

This is a discussion on SSH limit number of simultaneous logins attempts for each user within the CentOS / RHEL / Fedora forums, part of the Linux Distribution category; I want to configure SSH in following way: Pl. help on this. One user (Suppose UserName is "demosshuser") can be ...


Go Back   nixCraft Linux Forum > Linux Distribution > CentOS / RHEL / Fedora

Linux answers from nixCraft.


CentOS / RHEL / Fedora Discussion about Redhat Enterprise Linux or CentOS or Fedora Linux related problems.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 31-10-2009, 02:17 PM
kasimani's Avatar
Senior Member
User
 
Join Date: Jul 2006
Location: India, Delhi
OS: CentOS, RedHat, Fedora, Ubuntu
Posts: 151
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 4
kasimani is on a distinguished road
Send a message via Yahoo to kasimani
Default SSH limit number of simultaneous logins attempts for each user

I want to configure SSH in following way: Pl. help on this.

One user (Suppose UserName is "demosshuser") can be login into One server at the same time.
Once the user (Suppose UserName is "demosshuser") have login into that particular server, then the UserName (demosshuser) can't be used to login to server from any other console or by using any other SSH client, until "demosshuser" get logout.
Reply With Quote
  #2 (permalink)  
Old 31-10-2009, 07:15 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,707
Thanks: 11
Thanked 244 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Edit /etc/security/limits.conf and append the following to limit the max number of logins to 2 for user vivek:
Code:
vivek         hard    maxlogins       2
Save and close the file. If 3rd time vivek tries to login he will get an error:
Code:
Too many logins for 'vivek'.
and the following in auth.log or secure log file:
Code:
pam_limits(sshd:session): Too many logins (max 2) for vivek
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help

Last edited by nixcraft; 31-10-2009 at 07:17 PM.
Reply With Quote
  #3 (permalink)  
Old 03-11-2009, 02:23 PM
kasimani's Avatar
Senior Member
User
 
Join Date: Jul 2006
Location: India, Delhi
OS: CentOS, RedHat, Fedora, Ubuntu
Posts: 151
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 4
kasimani is on a distinguished road
Send a message via Yahoo to kasimani
Default

Can this is also be :

Is there any way to show Custom Message to the Users


"This User has already login in system... Try after some time... "
Reply With Quote
Reply

Tags
/etc/security/limits.conf , limit ssh login , openssh , openssh max number of logins , ssh max number of logins


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Failed SSH login attempts and how to avoid brute ssh attacks rockdalinux Networking, Firewalls and Security 19 12-02-2010 11:45 AM
Want a e-mail alert on unsucessful login attempts kumarat9pm CentOS / RHEL / Fedora 2 30-10-2009 07:19 AM
How to group the output w/ limit alvingo Shell scripting 1 26-07-2009 05:45 PM
postfix rate limit blackhat_hk Mail Servers 3 03-05-2008 07:57 PM
Restrict number of simultaneous proxy connections in SQUID proxy pkvmreddy Getting started tutorials 1 15-06-2007 03:52 PM


All times are GMT +5.5. The time now is 04:21 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38