Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Fedora This forum is for the discussion of the Fedora Project.


  Search this Thread
Old 02-16-2009, 06:54 PM   #1
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 168

Rep: Reputation: 30
Allow root access via PAM

I need to disable root access. However, I need root access from a specific IP address.

I disabled root access as follows:

# vim /etc/ssh/sshd_config
PermitRootLogin yes
PermitRootLogin no

# /etc/rc.d/init.d/sshd restart

The above disabled root access for good.
Next, I used PAM to allow access from a specific IP

# vim /etc/security/access.conf

I appended the following lines:

+ : root :
+ : root :
- : root : ALL


# vim /etc/pam.d/sshd

I appended the following entry

account required

With the above config, I'm still getting "permission denied" when I try to login via ssh from

What did I miss?
Old 02-17-2009, 02:55 AM   #2
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 655

Rep: Reputation: 40
I'm definately not an expert on PAM, but just a thought: If the "PermitRootLogin no" gets evaluated before PAM, it doesn't matter how you set up your PAM files. How about setting this option back to "yes", and control everything from PAM?
Old 02-17-2009, 03:32 AM   #3
Senior Member
Registered: Jan 2006
Posts: 4,362

Rep: Reputation: 172Reputation: 172
It is probably better to remote in as a user and then su - (su space dash) into root.
Old 02-17-2009, 09:13 AM   #4
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Originally Posted by lazlow View Post
It is probably better to remote in as a user and then su - (su space dash) into root.
No, you are wrong.

It's not "probably better". It's ALWAYS better.

And it could be even better to use sudo rather than "su -".


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
[SOLVED] Disable remote root access but allow local root access-- possible? bskrakes Linux - Security 3 03-03-2008 01:15 PM
PAM -- Allowing only certain users access DennisC31 Linux - Security 1 01-05-2008 07:26 PM
SAMBA shares allow access based on PAM zQUEz Linux - Newbie 2 06-26-2007 06:08 AM
deny ssh access with pam RobertCraven Linux - Security 5 05-12-2006 04:55 AM
how can I limit time access with pam hichem Linux - Security 4 11-17-2005 01:58 AM

All times are GMT -5. The time now is 09:46 PM.

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