LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 03-11-2008, 01:47 AM   #1
vvcat
LQ Newbie
 
Registered: Mar 2008
Posts: 18

Rep: Reputation: 0
Angry Only allow root login on console


Hi all,

we would like root account only allow to logon from console and not allow thru any tty, so our setting as belows, but root account still logon thru ssh or telnet, can everybody help, many many thanks.

#cat /etc/securetty
console

#cat /etc/pam.d/login
#%PAM-1.0
auth required pam_securetty.so
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session optional pam_keyinit.so force revoke
session include system-auth
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session optional pam_ck_connector.so
 
Old 03-11-2008, 02:17 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Assuming for the moment that you don't allow anybody to login with telnet (especially not root)... that leaves ssh logins. This is done by adding a line like this to /etc/ssh/sshd_config

Code:
AllowUsers      root
Though it is better to allow a user, and give that user specific permission for the particular admin tasks you want done.
 
Old 03-20-2008, 02:44 AM   #3
evilDagmar
Member
 
Registered: Mar 2005
Location: Right behind you.
Distribution: NBG, then randomed.
Posts: 480

Rep: Reputation: 31
Just freaking turn OFF telnet.

As to disabling root logins over ssh, in your sshd_config (likely in /etc/sshd) should be a commented out line like:

#PermitRootLogin yes

Simply take out the "#", change "yes" to "no" and restart sshd.

Last edited by evilDagmar; 03-20-2008 at 02:46 AM.
 
Old 03-20-2008, 03:04 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Not allowing any local tty logins may not be a good goal. What are you going to do if the NIC device goes out? Or if you lock yourself out accidentally from remote logins.

Root logins for ssh are also not a good idea. You can use the "AllowUsers" or "AllowGroups" options in sshd_config to only allow certain users the ability to log in. They can then use "su" or "sudo" to do what they need to.
 
Old 03-20-2008, 11:01 PM   #5
rg.viza
Member
 
Registered: Aug 2006
Posts: 74

Rep: Reputation: 15
Quote:
Originally Posted by jschiwal View Post
Not allowing any local tty logins may not be a good goal. What are you going to do if the NIC device goes out? Or if you lock yourself out accidentally from remote logins.
Yea, especially considering anyone with local access *will* root it in a few minutes with a boot cd if they have half a clue and that's what they want to do. Disabling CD in bios and putting a bios password on won't help either. You can simply reset the bios with a jumper. Physical access is > all software security measures. Not allowing local logins won't matter at that point. With a boot cd you don't need to log in.

A good lock on a sturdy rack cabinet is a much better (and secure) physical security solution. Think Medeco grade 1 for ultimate physical security, at least until people figure out how to bump key that one too.

If they have to hack through a bunch of hardened wire to get to the box, they'll find an easier target.

Is this at work? Suggest that the best physical security measure is good physical security, then demonstrate how easy it is to get around a local tty lockout with a boot cd. The setup disk for the distro you are using probably has a rescue mode that can be used for this demonstration.

On red hat it's:
linux rescue

at the boot prompt before setup.

#chroot /mnt/sysimage

Edit the files you need to, change root password, reboot.

Of course a sawzall will cut through most stuff like butter, but those are pretty loud and will usually attract attention Not good for someone trying to maintain a low profile and get into a box unnoticed.

-Viz
 
  


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
Secure root login on console only pyroman59 Linux - Software 1 11-01-2005 04:45 PM
Console- Login as root- conplete newbie SonicGT Linux - Newbie 2 11-02-2004 07:46 PM
Cannot login as root under console SuSE 8.2 HamishTPB Linux - General 3 07-11-2003 07:20 AM
Disable/Enable Root Login @ Console ryanstrayer Linux - Security 4 01-18-2002 04:49 PM
Please help: console root login incorrect! aponcel Linux - Networking 7 07-19-2001 02:42 AM

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

All times are GMT -5. The time now is 03:32 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