LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2007, 05:38 AM   #1
Panagiotis_IOA
Member
 
Registered: Jan 2006
Location: Hellas, Europe
Distribution: Slackware 12
Posts: 238

Rep: Reputation: 32
Permit number of connection from same user on SSH


Hi all,

As the title says I want each user to be able to login only once by using ssh. If he/she is already logged in then he/she shouldn't be able to login again.
Is there an entry for this in sshd_config or do I need to do it with iptables?

Thanks in advance!
 
Old 08-01-2007, 11:56 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by Panagiotis_IOA
Is there an entry for this in sshd_config or do I need to do it with iptables?
I don't think there is a parameter in sshd_config, and frankly, I don't know how you would do it with iptables. (If you can clue me in, I'm all ears! )

If the login shell for all of your users is bash, then you could edit /etc/profile so that if a user is already logged in, it immediately dumps them back out. (Make sure it's not the current login you are seeing!) I am not sure how to check that the existing login is via ssh, but there is probably a way.
 
Old 08-01-2007, 11:58 AM   #3
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
You can do it through pam.
 
Old 08-01-2007, 05:18 PM   #4
Panagiotis_IOA
Member
 
Registered: Jan 2006
Location: Hellas, Europe
Distribution: Slackware 12
Posts: 238

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by blackhole54
I don't think there is a parameter in sshd_config, and frankly, I don't know how you would do it with iptables. (If you can clue me in, I'm all ears! )
The only way with iptables I can think of is by blocking two connections on port 22, or whatever else port sshd may listening to, but this wouldn't allow another user from the same IP to login with a different account.

Quote:
Originally Posted by blackhole54
If the login shell for all of your users is bash, then you could edit /etc/profile so that if a user is already logged in, it immediately dumps them back out. (Make sure it's not the current login you are seeing!) I am not sure how to check that the existing login is via ssh, but there is probably a way.
Hm... I wasn't aware of that. Will try to find something out.

Quote:
Originally Posted by ramram29
You can do it through pam.
I haven't used pam before to be honest. It would be a good opportunity to do it now but then I think that it'll get more complex than what I was excepting to do. Thanks anyway
 
Old 08-02-2007, 01:39 PM   #5
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
The only way you'll be able to specify connection limits is through pam. It's weird to understand at first but once you get it then it'll stick in your brain forever.
 
Old 08-03-2007, 09:55 AM   #6
Panagiotis_IOA
Member
 
Registered: Jan 2006
Location: Hellas, Europe
Distribution: Slackware 12
Posts: 238

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by ramram29
The only way you'll be able to specify connection limits is through pam. It's weird to understand at first but once you get it then it'll stick in your brain forever.
Thanks for the information
 
  


Reply



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
ssh: connection to host port: 22: Connection timed out lost connection cucolin@ Linux - Server 4 11-22-2011 06:15 AM
ssh -X Proxy Display number Millenniumman Linux - Networking 0 04-09-2007 03:51 PM
Change ssh port number israel Linux - Software 2 08-30-2006 05:18 AM
A. how to permit more then one user to access a file mudasar Linux - Networking 2 11-20-2005 01:19 PM
Able to change port number between telnet and ssh? x5452 Linux - General 3 03-28-2004 05:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:18 PM.

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
Open Source Consulting | Domain Registration