Limit root user of SSH logins

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Limit root user of SSH logins
# 1  
Old 09-17-2013
RedHat Limit root user of SSH logins

Hi team,

I tried to modify the /etc/security/limits.conf file to limit the root user for more one login. I added the line in limits.conf file like:
Code:
@root            hard    maxlogins       1


I also tried to modify /etc/ssh/sshd_config to limit the root userlogin by adding this:

Code:
MaxSessions 2

But I do still able to login more than one time! Any help please..

Last edited by leo_ultra_leo; 09-17-2013 at 02:13 AM.. Reason: More details..
# 2  
Old 09-17-2013
Your limits.conf syntax is wrong. You are trying to limit a group named root, not a user named root. Change "@root" to "root"
# 3  
Old 09-17-2013
No I have this in limits.conf


I think that is no matter if I put @root since the root user is belong to root group. However, I removed the @ sign and made it like this
Code:
oot             hard    maxlogins       2

And I still able to login many times!
# 4  
Old 09-17-2013
This limit doesn't apply to a user whose userid is 0.
# 5  
Old 09-17-2013
Quote:
Originally Posted by Scott
This limit doesn't apply to a user whose userid is 0.
! Then how can I restrict the user root of multi login?!!
# 6  
Old 09-17-2013
I have no idea why you'd want to do that.

There are various ways to restrict root access to varying degrees, but not by just the number of SSH logins (and even that would be easily circumventable with, for example, su).
# 7  
Old 09-17-2013
I want to make sure that I'm the only root user over SSH.

I didn't expect this issue is on that difficulty to be solved!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Disable multiple ssh logins for an OS user in Solaris

Hi folks, I am fairly a beginner when it comes to Solaris OS administration, but part of my job somehow has scope to provide L1-level of OS administration over a few solaris servers. Now, we have a requirement to limit the number of simultaneous ssh logins/sessions to the server, sort of... (0 Replies)
Discussion started by: engrcha
0 Replies

2. Shell Programming and Scripting

Cisco, 2 ssh logins for expect /bash

HI all i need to connect to about 900 cisco routers and switch to do some configs changes. the issue i am having is that half the devices have one set of username and password and the other half have another username and password. From expect or bash script i can ssh into a device and make... (0 Replies)
Discussion started by: quintin
0 Replies

3. Windows & DOS: Issues & Discussions

Fail2ban: email notifications and banning ssh IP logins

Hi all. I am using Cygwin in Windows 7 and am trying to setup fail2ban so that I can ban foreign IP addresses under SSH, also getting email notifications. I downloaded fail2ban and installed it. I then created jail.local copy from jail.conf and changed some values in jail.local. Now when I try to... (2 Replies)
Discussion started by: synthesis
2 Replies

4. Cybersecurity

How to limit patchadd command to root user only?

How to limit patchadd command to root user only? I'm running a solaris 10 5/09 server, I have 2 users other than root. One being able to use the patchadd command and one is unable to do so. What I'm trying to do is to limit the patchadd command so that only root is able to run it. (7 Replies)
Discussion started by: ShouTenraku
7 Replies

5. Solaris

Display logins via SSH

For work, I need a box to show all logins made recently upon a successful login. Sort of a banner showing previous logins. Not sure how to go about this. (2 Replies)
Discussion started by: LittleLebowski
2 Replies

6. Shell Programming and Scripting

Cron job initiating ssh AND sudo (from user, not root)

I've been bashing my head on the desk for 2 days trying to get this to work, but I've had no luck. I'll try to be as clear as possible in my explanation without dragging out the details. I'm trying to set up a cron job for user "john" which runs a script. This script initiates an ssh connection to... (5 Replies)
Discussion started by: eh3civic
5 Replies

7. AIX

passwordless ssh for non-root user???

hi all I have a problem to set up the password ssh login for a non-root user. what I want to do is that non-root user in host A logs into host B without password prompted. what I did listed as the following steps. 1. genarate a pair of keys from host A. ssy-keygen -t rsa -N "" -f... (9 Replies)
Discussion started by: rs6000er
9 Replies

8. Solaris

How to configure ssh for root user....???

Hi Friends, I would like to configure ssh for root user. Note : I am able to use the ssh for other user. Can someone suggest me what needs to be done....??? Thanks & Regards, jumadhiya. (8 Replies)
Discussion started by: jumadhiya
8 Replies

9. AIX

allow / deny root logins

Hello everyone I have to limit the root logins on my aix box (aix 5.3) I change the value on the /etc/security/user default (login and rlogin) change to false and add to root (rlogin and login = false) I tried in different ways but I got the same. Root still can login I try algo... (6 Replies)
Discussion started by: lo-lp-kl
6 Replies

10. AIX

Limit logins to 1

Trying to limit 1 login per account... Setup: We have 2 auth logins, one to the AIX (telnet)then into a distribution mgmt software, the users do not have a shell to log into on the AIX itself, so placing a script such as: active=`who | awk '{printf",%s,\n",$1}' | grep ,$LOGNAME, | wc -l` ... (0 Replies)
Discussion started by: pheusion
0 Replies
Login or Register to Ask a Question