Root login in Linux - does it make sense?


 
Thread Tools Search this Thread
Special Forums Cybersecurity Root login in Linux - does it make sense?
# 1  
Old 11-07-2012
Root login in Linux - does it make sense?

I stumbled upon this thread and one aspect of it got me thinking. As i am building a small Linux network right now for a friend i would like to hear your opinion on this.

Quote:
Originally Posted by Corona688
...or just not do that. Typically you'd login as a regular user then su or sudo. This restriction is for a reason.
I'd like to respectfully disagree. I think the Linux habit of disabling root login per default is wrong (not entirely good, more precisely) , based on the following reason:

It is easy to see that for private purposes, where one (or any other very small number) of systems is in play this restriction makes sense. It enhances system security and is therefore a good thing to have.

Still, apart from private usage there is the corporate usage of Linux systems. Administrating up to several hundreds of (maybe virtualized) Linux systems typically involves carrying out one command on several or all systems in parallel. If i want to know which systems have a certain package/version combination installed I'd issue some rpm-command on all systems, for instance, to find out which systems need a certain update.

To do so is basically impossible without having root access to the system directly. Yes, it would be possible to query the version information as a normal user in the example above - suppose this shows that 50 systems need a certain package to be installed. You need root to do and nobody wants to go through the motions of logging on to one system after the other, issue a "sudo su - root", enter his own password fifty times and then carry out a single command to actually install the package.

Probably every commercial Unix has provisions to make this a one-liner. In IBMs AIX (this i know best) for instance there is "dsh" (distributed shell), which is a rework of a part of the PSSP middleware introduced for the SP/2 (i can't remember when this platform was launched, probably somewhere in the beginning of the nineties).

When i install AIX systems i usually start the customization with establishing exchanged ssh-keys as a "chain of trust" with some central management system (usually my NIM-server) and then use this system to administrate the system further. Most of my work is done without directly logging on to the system but by developing and executing scripts, which use "dsh" (or even while-loops feeding some host-list into a "ssh"-command) to execute commands remotely.

So, to come back to my point "log in as normal user and 'sudo su' to root" is an advice of dubious quality IMHO. Yes, if your system is for private use or anything similar to this it is good, in a real data center it is rather less practicable.

bakunin
# 2  
Old 11-07-2012
I think you've taken my position a little farther than I've meant it. I do login as root on occasion. I just don't allow root to login externally. That's what sudo's for -- it gives you the same thing in a less blunt, more careful way.
Quote:
Originally Posted by bakunin
Still, apart from private usage there is the corporate usage of Linux systems. Administrating up to several hundreds of (maybe virtualized) Linux systems typically involves carrying out one command on several or all systems in parallel. If i want to know which systems have a certain package/version combination installed I'd issue some rpm-command on all systems, for instance, to find out which systems need a certain update.
If you allow 'sudo su -' you might as well allow sudo to do other things since you have zero effective restrictions anyway. I have one sudo-enabled user that I use for administrative things. So you're left with the enormous hassle of 5 extra keystrokes per command.

Granted, I have made that particular user very difficult to get to via anything but ssh keys. The keys themselves are password protected, too. I login once in the morning, ssh-agent, and have access to my servers throughout the day.

Sometimes I'll push a job into root's cron table if I really need to run an awful lot of root commands.
# 3  
Old 11-08-2012
Quote:
Originally Posted by Corona688
That's what sudo's for -- it gives you the same thing in a less blunt, more careful way.[...]

I have one sudo-enabled user that I use for administrative things. So you're left with the enormous hassle of 5 extra keystrokes per command.
Fair enough. If i understand you correctly this would mean to roll out a single command on my management station might look like this:

Code:
while read WORKHOST ; do
     ssh someuser@${WORKHOST} "sudo su - root -c command"
done < /path/to/hostlist

with someuser being allowed to "su" to root without being asked for a password.

If so: what is the gain of having someuser login and switch to root without further authorization to having root log on directly? It is clear that this just transfers the "risk" from one user to the other.

There is one conceivable point for doing it this way and this is: if a host is under constant attack from bots then these bots will most likely try only "root" because the name of this user account is known. One can use any other non-default name for the "sudo-root-user" and the bots will not even try this name.

This is a valid argument but it is a predicament probably only a very few select systems are in. In most corporate networks this sort of attack is already stopped at the networks entry point.

bakunin
# 4  
Old 11-08-2012
I'm a fan of always logging in as a non-privileged user and then sudo -i to operate as the superuser. This is certainly true when the system is on a network, and most systems are on a network these days.

From a console login? Well, that depends on the physical security and the critical nature (importance) of the system.
# 5  
Old 11-14-2012
Quote:
Originally Posted by bakunin
If so: what is the gain of having someuser login and switch to root without further authorization to having root log on directly? It is clear that this just transfers the "risk" from one user to the other.
Not without my password-protected key, they can't. Even if they steal it, it won't work for them without the password. ssh-agent is how I use that to automate.
# 6  
Old 11-14-2012
Quote:
Originally Posted by Corona688
Not without my password-protected key, they can't. Even if they steal it, it won't work for them without the password. ssh-agent is how I use that to automate.
This was not what i meant: you have some user-account, which is allowed to log on AND it is allowed to "sudo su -". You protect this account with a password, a key and whatever else. This protection amounts to some level of security (whatever "some" is, this is not my point). If you would log in as root directly and have the same amount of security - the same key strength, the same password strength and whatever else you use to protect your user account. My point is that it follows, that these measures would amount to the same amount of security as with the user. It is equally hard to crack a key or a password, regardless of this key (password) protecting the root-account or any other user-account.

bakunin
# 7  
Old 11-15-2012
Quote:
Originally Posted by bakunin
This was not what i meant: you have some user-account, which is allowed to log on AND it is allowed to "sudo su -".
Ah, I see.

What this gets me is:
1) Nobody needs root's password.
2) You can't brute-force root over ssh, period.
3) There can be more than one account like this, for different people and purposes, and none of them need root's password or each others' passwords.
4) I can revoke root access at will with usermod without inconveniencing everyone.

So it's more for internal security than external, I suppose.

Last edited by Corona688; 11-15-2012 at 07:33 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Does it make sense to reduce the total shared memory

We have several dozen Redhat 5, 6 and 7 servers that are running Oracle databases. On some databases we are using automatic memory management, which uses shared memory. On other databases we are use manual memory management, which does not use shared memory. When I see that a server is swapping... (2 Replies)
Discussion started by: gandolf989
2 Replies

2. Red Hat

How to make a Password-Less Login from Windows to Linux using OpenSSH?

I installed the OpenSSH on my Windows Machine. I want to connect to the remote Linux machine without typing password. I followed the bellow instructions but the SSH needs password to establish the connection yet. Open CMD and run: ssh-keygen -t rsa (The public and private keys are generated in... (1 Reply)
Discussion started by: manoj.solaris
1 Replies

3. UNIX for Advanced & Expert Users

sar -d output... does not make sense

Can someone explain the correlation between how sar names the disk drives and how the rest of the OS names the disk drives? sar lists my disk drives as sd0, sd1, sd2, etc..... while format lists my disk drives as c1t0d0, c1t1d0, c1t2d0,etc... And also why sar shows 8 disks but format... (2 Replies)
Discussion started by: s ladd
2 Replies

4. UNIX for Dummies Questions & Answers

trying to make sense of rsync output...

I'm running the following rsync command to sync a directory between the 2 servers: rsync -az --delete --stats /some_dir/ server_name:/some_dir I'm getting the following output: Number of files: 655174 Number of files transferred: 14221 Total file size: 1138531979331 bytes Total... (0 Replies)
Discussion started by: GKnight
0 Replies

5. UNIX for Dummies Questions & Answers

a for loop that doesn't make sense

I've been referring bash info for processes and came across a structure for a process which is defined like typedef struct process { struct process *next; char ** argv . . . }process; What I don't understand is that in the program there's a for loop which goes like this job... (2 Replies)
Discussion started by: sdsd
2 Replies

6. High Performance Computing

Rocks clusters make sense for educational environments

08-18-2008 11:00 AM Cluster computing has played a pivotal role in the way research is conducted in educational environments. Because the amount of available money and hardware varies between university researchers, often it's necessary to find a clustering solution that can work well on a small... (0 Replies)
Discussion started by: Linux Bot
0 Replies

7. AIX

Can't login root account due to can't find root shell

Hi, yesterday, I changed root's shell in /etc/passwd, cause a mistake then I can not log in root account (can't find correct shell). I attempted to log in single-mode, however, it prompted for single-mode's password then I type root's password but still can not log in. I'm using AIX 5L version 5.2... (2 Replies)
Discussion started by: neikel
2 Replies

8. Linux Benchmarks

Linux Benchmarks Makes No Sense

I created two computers with identical hardware, and run the benchmark programs in both starting at the same exact time. What makes no sense is that the computer that has the lower average index (121) finished the race a good 30 minutes ahead of the computer wich showed the higher avg index... (0 Replies)
Discussion started by: philip_38
0 Replies

9. Answers to Frequently Asked Questions

Lost root password / Can't login as root

We have quite a few threads about this subject. I have collected some of them and arranged them by the OS which is primarily discussed in the thread. That is because the exact procedure depends on the OS involved. What's more, since you often need to interact with the boot process, the... (0 Replies)
Discussion started by: Perderabo
0 Replies
Login or Register to Ask a Question