-2

I have a Nagios, and Gammu installed.

When I use gammu as root, like the following :

/usr/bin/gammu identify (or else)

It works, but when I do it as nagios user, i got this answer :

Can't open specified file. Read only?

I even put nagios in the root group, I used visudo with :

nagios ALL=(ALL)  ALL

But no ... I can't find any solution with google. So if someone got an idea, it would be great !

I don't have any error in logs...

This was solved using this link.

So I added :

ALL=(root) NOPASSWD: /usr/sbin/smartctl

And in the plugin :

my $smart_command = '/usr/bin/sudo /usr/sbin/smartctl'
Nico
  • 302
  • 1
  • 5
  • 17

1 Answers1

1

You will need to put your nagios user in the dialout group or whatever group it is that has access to the serial ports connected to the GSM modem.

find out with something like this:

ls -l /dev/ttyS2
crw-rw---- 1 root dialout 4, 66 May 17 12:19 /dev/ttyS2

(but replace ttyS2 with the correct device).

Using sudo is the wrong approach for a program like gammu that is called by a daemon process.

Sven
  • 97,248
  • 13
  • 177
  • 225
  • Thanks for your reply, but already done. My group is 'uucp', and nagios belong to it. And I haven't any dialout group, I can't explain why ? Thank you @SvW (btw why I got a -1 ?) – Nico Aug 01 '13 at 09:22
  • I also tried chmod 4777 and 2777 but still have a problem. And with 4777, when i launch my /usr/bin/gammu, I have the same problem : Can't open specified file, even if I'm loggin as root ... Need help :) – Nico Aug 01 '13 at 10:27
  • Have a look at http://users.telenet.be/mydotcom/howto/nagios/pluginsudo.html. Here's the solution ;) (Can't answer my own post =[ ) – Nico Aug 01 '13 at 10:43