{ 1 trackback }

Planet Malaysia Blog » Blog Archive » SSH Root Access Login Control
08.03.06 at 5:08 am

{ 10 comments… read them below or add one }

1 Planet Malaysia 08.03.06 at 3:56 am

Weird! I added “account required pam_access.so” into “/etc/pam.d/sshd” and modify “/etc/security/access.conf” to
“-:ALL EXCEPT root:10.10.10.12″ but I still managed ssh login from other IP Address(e.g: 10.10.10.2, 10.10.10.3)

2 Planet Malaysia 08.03.06 at 4:53 am

I found a solution:
vi /etc/security/access.conf and added this 2 lines
- : root : ALL
+ : root : 10.10.10.52.
and save.

3 jeremiah 08.30.06 at 2:02 pm

You state that one should edit /etc/pam.d/sshd to enable the access.conf file. But this is not really what you should advise. What you should say is that one has to edit /etc/pam.d/ssh and add a line forcing usage of /etc/security/access.conf. If one just hacks on /etc/pam.d/sshd then anyone can still login since you have not configured PAM access.conf!

4 jeremiah 08.30.06 at 2:03 pm

You have to modify /etc/pam.d/ssh not /etc/pam.d/sshd

5 nixcraft 08.30.06 at 2:31 pm

The file name changes from one Linux distro to another. So it may be ssh or sshd.

6 Matthew Feinberg 10.03.06 at 6:26 pm

That’s because pam_access scans access.conf for the first entry that matches the (user, host) combination. Your line does not match any address except 10.10.10.12, so you have denied all users except root from logging in from 10.10.10.12. The line does not effect connections from any other host.

7 Thorne Lawler 01.14.09 at 2:52 am

How should this (fairly obvious, common) restriction be implemented on systems which do not use PAM?

I’m quite disappointed with the OpenSSH dev team for this: A multitude of other Allow/Deny mechanisms have supported this kind of behaviour for longer than I’ve been alive. Why the great leap backwards?

8 Khandakar Ashfaqur Rahman 03.19.09 at 5:59 am

Good Solution.

Regards,
Rigan

9 James 06.04.09 at 8:52 pm

@Thorne

Actually, OpenSSH does support a multitude of Allow/Deny mechanisms, though I believe they are all ANDed together. Thus, obtaining the behavior described in the intro to this page is not possible with OpenSSH alone. Here are the Allow/Deny mechanisms supported by OpenSSH.

AllowGroups
AllowTcpForwarding
AllowUsers
DenyGroups
DenyUsers

10 Max 06.24.09 at 11:50 pm

How do you edit the access line to accept a group name with a space in it?:
-:ALL EXCEPT Domain Users :ALL seems to read the groups as Domain and Users. adding “quotes” didn’t work either.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: KDE 3.5.4 Released and available for download

Next post: Novell – Suse Linux book for new users (pdf format)