3

I normally do snmptraps and other net-snmp commands without problems with root session, but when i try to execute same commads with a normal user i obtain follow errors:

Cannot rename /var/lib/net-snmp/snmpapp.conf to /var/lib/net-snmp/snmpapp.0.conf

Cannot unlink /var/lib/net-snmp/snmpapp.conf

read_config_store open failure on /var/lib/net-snmp/snmpapp.conf

read_config_store open failure on /var/lib/net-snmp/snmpapp.conf

read_config_store open failure on /var/lib/net-snmp/snmpapp.conf

I try to search for a .conf file for add the necessary permisions to all net-snmp to a normal user but i don't find it exactly what to do, for fixing this problem.

Thank you for your help.

User1234552
  • 31
  • 1
  • 6

2 Answers2

6

I have faced similar issue and resolved it by following a discussion at http://sourceforge.net/p/net-snmp/bugs/1706/. I think the pith of the problem has to do with running the snmptrap command with an unprivileged user. In which case a user specific configuration should be created by adding the following line:

persistentDir /home/user/.snmp_persist

in ~/.snmp/snmp.conf

After you run snmptrap you should see something similar to:

Creating directory: /home/user/.snmp_persist

I hope this helps.

tazarov
  • 61
  • 1
  • 3
1

A quick look at the snmptrapd man page shows the following:

Note: the default is to listen on UDP port 162 on all IPv4 interfaces. Since 162 is a privileged port, snmptrapd must typically be run as root.

I am not familiar with snmpapp.conf but I would start with looking at the permissions for /var/lib/net-snmp/snmpapp.conf. What distro are you running and are you using any sort of frontend to SNMP?

chuck
  • 524
  • 2
  • 7
  • Using fedora core 19, i don't use a frontend snmp i sent snmtptraps automatically using bash scripts. – User1234552 Aug 13 '14 at 12:51
  • OK. Is the output above from your scripts? It looks like the snmpapp file is being renamed then replaced with something different or a modified version of the original. This would point to an issue with permissions. With RedHat flavored distros SELinux could also be an issue. You could use setfacl to give a normal account write privileges on the required files to see if that fixes things. – chuck Aug 13 '14 at 13:27