Bug 566 - Changing the name of the root user, sudo does not authorize.
Changing the name of the root user, sudo does not authorize.
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.4
PC Other
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-05 18:09 MDT by baris
Modified: 2012-08-21 13:02 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description baris 2012-08-05 18:09:15 MDT
I changed the root user name as root2.
I opened by the root user a standard user. and gave authority to reboot.
But, give me that error.
root@test:~$ sudo reboot
reboot: must be superuser.
Comment 1 Todd C. Miller 2012-08-06 10:03:52 MDT
I'm not sure I understand you.  Sudo runs commands as user "root" by default.  If you change root's uid to something other than 0, sudo will run commands as whatever uid "root" has in the passwd file.

If root has a non-zero uid, that would explain why you can run "sudo reboot".  You will need to add a line to sudoers like:

Defaults runas_default root2

if root2 is the "real" (ie: uid 0) root user.
Comment 2 baris 2012-08-06 10:12:41 MDT
Thanks for answer.

My /etc/passwd file
root2:x:0:0::/home/root2:/bin/sh
usersun:x:999:999::/home/sun:/bin/bash


MY /etc/sudoers
Defaults	env_reset
root2	ALL=(ALL) ALL
usersun ALL=(ALL) NOPASSWD: /sbin/reboot , /bin/ln , /usr/bin/apt-get , /bin/kill , /usr/bin/killall , /usr/bin/pkill , /usr/local/bin/* , /usr/bin/crontab , /usr/sbin/usermod

ERROR MASSAGE
usersun@test:~$ sudo reboot
reboot: must be superuser.
Comment 3 Todd C. Miller 2012-08-06 10:29:11 MDT
I'm surprised you don't get a message from sudo like this:

sudo: unknown user: root
sudo: unable to initialize policy plugin

But either way, since sudo looks up the root user by name, you need to tell it to run things as "root2".  There was a typo in the Defaults entry I entered earlier, it should be:

Defaults runas_default=root2

Once you have that in your sudoers file you should be able to run reboot.
Comment 4 baris 2012-08-21 13:02:26 MDT
Defaults runas_default=root2
It's okey. thanks