Ad Widget

Collapse

Execute lastb command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Domdo
    Junior Member
    • Sep 2023
    • 3

    #1

    Execute lastb command

    Hello,

    I created a conf file (where the agent runs) with the UserParameter option to run the lastb Linux command.
    The key is created on the Zabbix server and I have restarted the agent.

    The agent's response is as follows: Permission denied for /var/log/btm

    I would like a list of the last failed connection attempts, do you have an idea how to get the list ? and if it's possible with Zabbix ?

    Thx
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Simple file permission issue... Or that file is actually missing..
    People very often forget, that zabbix user is simple unprivileged user and to read something, it needs additional access privileges...

    Comment

    • Domdo
      Junior Member
      • Sep 2023
      • 3

      #3
      The file with the UserParameter has read/write rights for root.
      The btmp file (typing mistake in the previous post) exists and has read and write rights for root too.

      If I run the command while logged in with sudo, it works.
      I may have missed something, could you explain me step by step how to configure the agent to run the command ?

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        root, root, root....

        Agent does not run as root...
        Explaining here linux user permissions and ways to run things as some other user would be too much ... Not really related to Zabbix but to general linux knowledge...

        Comment

        • Domdo
          Junior Member
          • Sep 2023
          • 3

          #5
          Indeed, that's what I thought.

          I'll keep the idea in a corner, but I'd rather not give root rights to the zabbix agent.
          Maybe the best thing would be to run a script and send the result to a file, then ask zabbix to read the file.

          In any case, thanks for your feedback.​

          Comment

          Working...