SNMP:非 root 用户

Use*_*552 3 linux snmp

我通常执行 snmptraps 和其他 net-snmp 命令,而不会出现 root 会话问题,但是当我尝试使用普通用户执行相同的命令时,我会收到以下错误:

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
Run Code Online (Sandbox Code Playgroud)

我尝试搜索 .conf 文件,以向普通用户添加所有 net-snmp 的必要权限,但我没有找到解决此问题的确切方法。

感谢您的帮助。

小智 6

我遇到过类似的问题,并通过http://sourceforge.net/p/net-snmp/bugs/1706/上的讨论解决了它。我认为问题的本质与使用非特权用户运行 snmptrap 命令有关。在这种情况下,应通过添加以下行来创建用户特定配置:

persistentDir /home/user/.snmp_persist
Run Code Online (Sandbox Code Playgroud)

在~/.snmp/snmp.conf中

运行 snmptrap 后,您应该看到类似以下内容的内容:

Creating directory: /home/user/.snmp_persist
Run Code Online (Sandbox Code Playgroud)

我希望这有帮助。