September 06, 2010, 05:42:52 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to The Host Helpers! | Second free utility will should be available in the next 240 hours.
Advanced search
Pages: [1]
Print
Author Topic: [HOWTO] Limiting access to your Linux machine  (Read 67 times)
Richard F
Jr. Member
**
Posts: 77


I'm a Gentoo man!


View Profile WWW
« on: July 28, 2010, 03:23:36 PM »

OK, so the default access rules on a linux machine are quite lax

Here's how to make them better.

This guide will cover limiting who can log on where by text, not on any graphical stuff (hence being in the server admin section ;] )



Access control is done through a file called /etc/security/access.conf

access.conf is composed of one entry per line, with fields separated by a colon (:)

The fields are:
  • Whether to allow or disallow
  • Who to allow or disallow
  • Where to allow or disallow

So as an example, to disallow root login from anywhere other than local terminals:

Code:
-:root:ALL EXCEPT LOCAL

The minus sign says to disallow, then there is root (the account you're limiting), and then ALL EXCEPT LOCAL, which says that you want the rule to apply to everywhere except locally

If you wanted to allow root to login on tty1, you would have

Code:
+:root:tty1

Again, with the plus saying that you want to allow, the root being the account you are limiting, and the tty1 being where you are limiting.


The way that I have my servers set up now is to disallow root logins everywhere except tty1 (so I know that I can only be logged in in one place), and disallow anyone who isnt in the wheel or clilogin groups.

Code:
-:ALL EXCEPT wheel clilogin root:ALL
-:root:ALL EXCEPT tty1
« Last Edit: July 28, 2010, 04:09:45 PM by rvtraveller » Logged
rvtraveller
The very scary
Administrator
Hero Member
*****
Posts: 1029


View Profile
« Reply #1 on: July 28, 2010, 04:10:05 PM »

Fixed your issue with a colon and parenthesis making a  Smiley
Logged

Primefalcon
Hero Member
*****
Posts: 1236



View Profile WWW
« Reply #2 on: July 28, 2010, 09:21:07 PM »

Actually I'd argue that there are a lot of times that you need to log in as root from a remote location, that's why the firewalls in Linux disallow ports by defaults, which means if you want to open ports for say ssh, you do it.

Also a lot of Linux systems like Ubuntu actually disallow root login even locally
Logged

Dropbox is a great cloud solution, get 2.25G of space by CLICKING HERE, Rather than 2G otherwise. Sync files between multiple computers over the web and even share folders with your friends!
Richard F
Jr. Member
**
Posts: 77


I'm a Gentoo man!


View Profile WWW
« Reply #3 on: July 29, 2010, 12:55:54 PM »

I've never been denied a root login locally. (even on Ubuntu machines)

I would counterargue that you should log in with a standard user account, and then sudo or su to do whatever you need.
Logged
Primefalcon
Hero Member
*****
Posts: 1236



View Profile WWW
« Reply #4 on: July 29, 2010, 11:34:07 PM »

That's odd since Ubuntu actually has the root login completely disabled by default..., in favour of people using sudo

read this:
https://help.ubuntu.com/community/RootSudo

I do agree with you 100% that all distributions should do this by default
« Last Edit: July 31, 2010, 02:52:03 AM by Primefalcon » Logged

Dropbox is a great cloud solution, get 2.25G of space by CLICKING HERE, Rather than 2G otherwise. Sync files between multiple computers over the web and even share folders with your friends!
Pages: [1]
Print
Jump to:  

Black Rain by Crip Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC XHTML | CSS