I'm root and els says I'm not (ubuntu 14.04) [closed]

-4

After the installation of ELS (easy linux secutiry) when I give the following commands:

els --update; els --chkrootkit; els --rkhunter; els --chmodfiles; els --disabletelnet; els --hardensysctl; els --libsafe; els --mytop; els ---securepartitions

I am not logged in as root, and I AM YES !! ... I already tried to run putting sudo and tbm says I am not root ...

Please help me, thank you in advance!

    
asked by anonymous 28.02.2016 / 18:11

1 answer

1

I do not really have an explanation of why this occurs, but the following made the command work for me:

On els.sh installed (on my computer it was / usr / local / els / ), you will find the following at line 86 of code: / p>

## Make sure the script is being executed as root
rootcheck() {
   if [ "${UID}" != "0" ]; then
      echo "This program must be run as root.  Exiting."
      exit 0
   fi
}

Change if to:

## Make sure the script is being executed as root
rootcheck() {
   if [ "$(id -u)" != "0" ]; then
      echo "This program must be run as root.  Exiting."
      exit 0
   fi
}

With this change the command behaves as expected:

  • Running as normal user:

    $ els --version
    This program must be run as root.  Exiting.
    
  • And as root:

    # els --version
    ELS version is 3.0.0.3. It is the latest release, there is no need to update.
    
28.02.2016 / 19:52