LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-17-2007, 02:05 AM   #1
yanziqiang
LQ Newbie
 
Registered: Dec 2007
Posts: 2

Rep: Reputation: 0
Limit multiple SSH login by the same user


Hi,

I'd like to limit multiple SSH login by the same user on a Linux box (eg. Fedora Core 4,5 or CentOS 4.x).

Pls reply if you know how to do this. Thx.
 
Old 12-17-2007, 03:53 AM   #2
brianmcgee
Member
 
Registered: Jun 2007
Location: Munich, Germany
Distribution: RHEL, CentOS, Fedora, SLES (...)
Posts: 399

Rep: Reputation: 40
You can set a maximum number of logins in /etc/security/limits.conf for an user or a group of users.

For example:
Code:
# echo "@loginrestriction  -  maxlogins 4" >> /etc/security/limits.conf
# echo "username  -  maxlogins 1" >> /etc/security/limits.conf
# useradd -G loginrestriction someuser
 
Old 12-17-2007, 09:41 AM   #3
wanghao
Member
 
Registered: Mar 2007
Distribution: centos
Posts: 126

Rep: Reputation: 15
Oh,good it's rather good!Thanks,i've test it .
 
Old 12-17-2007, 09:57 PM   #4
yanziqiang
LQ Newbie
 
Registered: Dec 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thx, brianmcgee. I'll test it when I have the time.

Thx to wanghao too for letting me know ur success in testing it. May I know which linux distro u tested on?

This forum rocks, I din expect to get a convincing reply in less than a day!

Cheerio to u 2.
 
Old 12-19-2007, 09:29 AM   #5
wanghao
Member
 
Registered: Mar 2007
Distribution: centos
Posts: 126

Rep: Reputation: 15
ok,the distro of mine is centos5 ,and how about you issue now ?
 
Old 12-19-2007, 09:43 AM   #6
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by brianmcgee View Post
You can set a maximum number of logins in /etc/security/limits.conf for an user or a group of users.

For example:
Code:
# echo "@loginrestriction  -  maxlogins 4" >> /etc/security/limits.conf
# echo "username  -  maxlogins 1" >> /etc/security/limits.conf
# useradd -G loginrestriction someuser
Does this method prevent someone from running multiple logins from within screen, for example?
 
Old 12-19-2007, 10:03 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590
Quote:
Originally Posted by pwc101 View Post
Does this method prevent someone from running multiple logins from within screen, for example?
What's keeping you back from testing this yourself?
 
Old 12-19-2007, 10:38 AM   #8
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by unSpawn View Post
What's keeping you back from testing this yourself?
Not wanting to break my system when I accidentally delete /etc!

Point taken though, I'll give it a go.
 
Old 12-19-2007, 03:20 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590
Quote:
Originally Posted by pwc101 View Post
Not wanting to break my system when I accidentally delete /etc!
Heh. So you don't make backups? ;-p
 
Old 12-19-2007, 03:33 PM   #10
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Fortunately, I do, but I've not yet had to restore anything (touch wood!) and I'm not looking forward to the day when I do. My girlfriend won't be very impressed with me spending even more time on my computer
 
Old 12-22-2007, 05:06 AM   #11
prasanta
Member
 
Registered: Mar 2005
Location: India
Distribution: Debian
Posts: 368

Rep: Reputation: 37
[QUOTE=pwc101]

From inside the screen you can do multiple logins. :-( Does not matter what your limits.conf file say.

Quote:
My girlfriend won't be very impressed with me spending even more time on my computer
When will backup scripts be useful? :-)

--
Prasanta
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian, Winbind: how to limit user login franz130175 Linux - Networking 2 01-20-2013 12:00 PM
Limit user via SSH (AllowedUser) but how NOT to affect vsftpd? Swakoo Linux - Security 13 06-25-2007 09:33 AM
SSH - cannot login as 1 particular user pnellesen Linux - Networking 7 11-24-2006 11:25 PM
Fast User Switching or Multiple X login screens - How? suslik Slackware 10 08-31-2004 07:50 AM
HELP me on SSH User login manya Linux - Security 1 05-03-2004 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration