1

In this shop root access is being handed out in a way that I'm not familiar with. See below. I have all the access I need, I was just wondering why the sudoers mechanism is not being used. I have to su to root and that by using the sudo su - root command. Nothing else works - see below. The /etc/sudoers file is basically empty.

[linuxuser@lx-vm32 ~]$ sudo -i
[sudo] password for linuxuser:
Sorry, user linuxuser is not allowed to execute '/bin/bash' as root on lx-vm32.company.com.
[linuxuser@lx-vm32 ~]$ sudo ls
[sudo] password for linuxuser:
Sorry, user linuxuser is not allowed to execute '/bin/ls' as root on lx-vm32.company.com.
[linuxuser@lx-vm32 ~]$ sudo su root
[sudo] password for linuxuser:
Sorry, user linuxuser is not allowed to execute '/bin/su root' as root on lx-vm32.company.com.
[linuxuser@lx-vm32 ~]$ sudo su -
[sudo] password for linuxuser:
Sorry, user linuxuser is not allowed to execute '/bin/su -' as root on lx-vm32.company.com.
[linuxuser@lx-vm32 ~]$ sudo su - root
Last login: Tue Mar  5 08:10:58 CST 2019 on pts/3
[root@lx-vm32 ~]#
8
  • 1
    as the linuxuser user, what does sudo -l show you? It may be that this user is expressly limited to sudo su - root. Mar 5, 2019 at 14:40
  • 1
    Add the sudoers file's contents to your question
    – wurtel
    Mar 5, 2019 at 14:53
  • Use below command to check what type of sudo access you have on host sed -n '/linuxuser/Ip' /etc/sudoers Check it as root Mar 5, 2019 at 15:24
  • Does the sudoers file contain a line like #includedir /etc/sudoers.d ? Mar 5, 2019 at 15:56
  • 1
    @TimKennedy: yep - that appears to be it: User linuxuser may run the following commands on lx-vm33: (ALL) NOPASSWD: /bin/su - root And without password!
    – Jozef
    Mar 6, 2019 at 19:44

2 Answers 2

1

Seems to me the issue isn't really with sudo, probably more of a security hardening issue. Since you have the root password, have a look at the stick-bits/permissions on the your sudo file.
On my unhardened machine:

[root@unhardened] ls -l /usr/bin/sudo 
-rwsr-xr-x root root /usr/bin/sudo

On my hardened machine:

[root@hardened] ls -l /usr/bin/sudo 
-rwxr-x--- root root /usr/bin/sudo

That may be the real culprit here. No sticky bit on sudo.

2
  • I don't even have the root password... Seems they have it set up to not need to know the root password, but at the same time not using the sudoers file. ls -l /usr/bin/sudo ---s--x--x. 1 root root 147392 Sep 25 01:02 /usr/bin/sudo
    – Jozef
    Mar 6, 2019 at 19:43
  • That's not the sticky bit, it's the setuid bit (which makes sudo run as the file's owner -- root). Sticky would be indicated by a "t" or "T" in the last of the mode bit characters (instead of the "x" or "-" in the "other" section). Sep 6, 2022 at 0:22
-1

The problem may be in the sudoers file in the /etc directory which contains system and user config files.

1) switch your user to root by doing " su - "

2) once your root type " visudo "

3) look for a title called 'User privilege specification'

4) there should be something which says ' root ALL=(ALL:ALL) ALL ' this is the sudo configuration for the root user. if you do not see this then that explains the problem

5) under the 'User privilege specification' section type 'root ALL=(ALL:ALL) ALL " KEEP IN MIND THAT THERE IS 4 SPACES INBETWEEN THE WORDS 'root' and the first 'ALL'.

2
  • The user is not running as the root user. The sudoers line that you indicate would not come into effect here.
    – Kusalananda
    Mar 5, 2019 at 18:06
  • it may not be for the root user but it is definetly for the user 'linuxuser' as well as this he/she said the sudoers file is empty which also may explain the problem...
    – programmer
    Mar 5, 2019 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .