0

i would like to set all users to be root. How can i do it? I am using ubuntu.

5
  • Prolly should be moved to Unix/Linux
    – user68142
    Mar 7, 2011 at 21:15
  • 8
    Whatever you are trying to do, you're most certainly doing it in a very wrong way.
    – user16115
    Mar 7, 2011 at 21:42
  • This could bring new meaning to the "open" part of OpenBSD! =P Mar 8, 2011 at 3:02
  • @Randolf: As soon as Ubuntu stops being Linux, sure. Mar 8, 2011 at 12:46
  • 1
    No one has asked why you want to do this. Do you want them all to be root, or have root privileges, or be able to su and run certain executables with root privileges etc? That context could steer the answers.
    – Rory Alsop
    Mar 9, 2011 at 11:12

4 Answers 4

3

There is only one root: root.

If you want to give all users administrative privileges, run this command for each user:

adduser the_accounts_username admin
2
  • Technically, root privileges are determined by the UID zero, not by the "root" username. Mar 8, 2011 at 12:47
  • Well, I think having the root username is enough in this case. I wouldn't be going around setting 0:0 on random files...
    – Blender
    Mar 9, 2011 at 19:03
2

You ought to be a bit more discerning about who you give root privileges to.

Since you're using Ubuntu - and I assume don't want certain users to have to keep sudo'ing everything - you might look at modifying the /etc/sudoers file:

sudo -i
echo 'USERNAME ALL=(ALL) ALL' >> /etc/sudoers

This will allow user with username USERNAME to run any command without sudo'ing.

1
  • It's no good practice to edit the sueders file directly. Use visudo instead. Furthermore your example does not remove the need to type sudo before the actual command. It doesn't even remove the need to enter the password each time. (This would be like "ALL = NOPASSWD: ALL")
    – user16115
    Mar 7, 2011 at 21:39
1

Just give everyone the root password.

It is sadly simply not possible to give anyone the same privilegues as root, because root is special, and even overrides all filesystem permissions. If Windows e.g. it is possible to tell Administrator not to go into a directory, and then we won't be able to do that (althought he might give himself the permission).

On Linux root just can do everything. Some things can JUST be done by root, like opening server ports below 1024. No one else can do this. Period.

PS: I don't know WHY you want to do it, but maybe sudo is the way to go. I can't believe you want everyone to do everything. Try to specify what everyone is allowed to do, and add it into the sudo config.

0

Literally, this can be done; however the badness of this idea should stand out like a sore thumb. I provide this answer for completeness only.

For all users you want to log in as root, change the UID to zero:

root:x:0:0::/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologon
...
user1:x:0:0:User 1 name,,,:/home/user1:/bin/bash
user2:x:0:0:User 2 name,,,:/home/user2:/bin/bash

Don't try to change the system users to zero, they don't like that. You may also encounter a few pieces of software that don't like running as root. su nobody -s 'start-command' will start them (usually).

You must log in to answer this question.