1

I know that root has full admin rights thanks to something in the kernel that gives to uid 0 those rights.
I think that also the name "root" is defined in the kernel, right?

And the location of the home (/root) is also defined in the kernel?
I can set it anyway in the /etc/passwd file.

How can I add another root with different uid and name?
Let's call it toor as in some unix operative systems, but there toor is simply another user with uid 0.

This toor should have uid at least 1000 as standard users, since I would like to use it as my account.

I thought about it and I think that is a good idea to have an user with full admin rights.
If I set the same uid is like using root.

Some services treat root as a system user and some use it for some processes, therefore I would like to do this.
Not that I have problems but it seems better.
Furthermore some apps have root check that you have to remove if you are using root.

I use the kernel provided from my OS, Debian 10:

uname -r
5.10.0-0.bpo.5-amd64
1
  • Provided from the buster-backports. Commented May 20, 2021 at 18:09

2 Answers 2

2

It's a good idea to setup a user that has admin capabilities which can perform admin functions via the sudo mechanism. This avoids you needing to enter your root password.

By default, Debian gives admin capabilities to the first user created during install. But you can't use a "root2" user without providing the necessary authentication - so system services will frequently still use root.

The link between the UID and the user can be found in /etc/passwd. root always has a UID of zero.

5.10.0-0.bpo.5-amd64 is not the standard Debian 10 kernel - its a backport. However, I'm using the same kernel without any problems. AFAIK Buster uses a 4.19 kernel.

5
  • I know about sudo, sudoers don't have full admin rights. I am looking to how add another root with different uid and name. Commented May 20, 2021 at 18:09
  • Sudoer's do have admin rights in interactive sessions - anywhere you can authenticate your access to root functionality. Permissions are specified according to UID - I have never tried to create two users with the same UID but I'm sure it isn't possible. If you did succeed in creating an alias for root, it would just double the crackability of your system. Commented May 20, 2021 at 22:49
  • Same uid? I am looking for a way to add another root with different uid and name. Sudoers aren't root, is not the same. With root I mean an account with full admin rights like root.... Commented May 21, 2021 at 7:51
  • 1
    Then use root... Commented May 21, 2021 at 7:55
  • As I said in the question I use it, but I would like to create another. But you need some kernel coding to grant to another uid admin rights, or to add a way to create more roots directly like normal users. Commented May 21, 2021 at 8:10
0

Short answer is, you can't. The name "root" is mostly arbitrary... it's UID 0 that matters. You can assign as many UID 0 users in /etc/passwd as you want to and when they login, they will be the same as root. Any other UID won't be root until it executes some other process as UID 0.

Outside of kernel manipulation there is no way to have root access without UID 0. sudo simply execs processes as root since it is a suid program. There isn't anything special about sudo other than it uses sudoers to try and govern its own use of the suid bit on it's executable.

sudoers absolutely DO have full admin rights, as defined and limited within the sudoers file. sudoers ALL gives away the kingdom.

You're going down the wrong road and making things way more complicated than they need to be. You're thinking of making your personal account (toor) some kind of root equivalent account. This is the wrong approach and is really what sudo and sudoers are there to handle. If you want root access using an account called toor, then simply add a rule in sudoers allowing toor to run "sudo su" and you'll be fully root when you sudo it. Or better yet, if you're the only admin, simply use su to become root and forget all the delegation and equivalence mess.

8
  • You don't need sudo su. That's like saying "sudo please can I have root... thank you... now that I'm root I'd like to run su to become root". Commented May 23, 2021 at 8:19
  • With full admin rights I mean that you can do things directly. No need to open a terminal and use sudo or somehow grant the rights, you have these rights. By default you can't but with some kernel coding shouldn't you able to achieve this? Commented May 23, 2021 at 8:37
  • How do you plan to execute OS level commands without opening a terminal session? @raima I only suggested sudo su as an easy way for him to use his own password when switching instead of the actual root password. Otherwise, yes - a complete waste of effort. Commented May 24, 2021 at 17:13
  • I use mostly the GUI, and as I said I would like to have the privileges directly without having to use sudo or something else. Commented May 25, 2021 at 14:48
  • As I said... you can't without being UID 0. I highly recommend against it, but if this is really what you want, then edit the passwd file and change your UID to 0. Commented May 25, 2021 at 20:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.