4

I could quickly go through the snmp installation and it works fine.

In one of the agent modules I am currently looking into and trying to modify the source. I came across an issue where I need to remove the user by the agent.

Stuck with to complete this:

Just like the way net-snmp-create-v3-user creates an user at server side I was wondering if there is something similar to remove the user.

Paul Sonier
  • 36,435
  • 3
  • 72
  • 113

2 Answers2

6

In my understandings, the net-snmp-create-v3-user would simply do the following:

service stop snmpd
$EDITOR  /var/lib/net-snmp/snmpd.conf
[add *usmUser* lines]
$EDITOR  /etc/snmp/snmpd.conf
[add *rouser* and *rwuser* lines]
service start snmpd

The snmpd should be stopped before adding new user data in the .conf files.

Equivalent to net-snmp-create-v3-user, removing an user would be something similar:

service stop snmpd
$EDITOR  /var/lib/net-snmp/snmpd.conf
[find and remove *usmUser* info]
$EDITOR  /etc/snmp/snmpd.conf
[find and remove *rouser* and *rwuser* info]
service start snmpd

Rather than printable characters, the usmUser fields are expressed as hex strings. They are simply not encrypted.

Ashwin
  • 1,872
  • 4
  • 26
  • 57
1

I just had a similar issue. I had added an user, and wanted to delete it again. However, net-snmp removes the createUser statements from the /var/net-snmp/snmpd.conf file for security reasons, thus Ashwin kumar's answer did not work for me (* see EDIT below).

snmpusm has a delete option, which can be used to remove users. snmpusm requires another user to authenticate the delete request (I haven't tested without, but I would assume that the other user has to have RW access). The following example has enabled me to remove a user from my snmp configuration:

snmpusm -v 3 -u <RWUSER> -l authNoPriv -a MD5 -A <PASSWORD_OF_RWUSER> localhost delete <USERNAME_TO_DELETE>

This solution is inspired by this page http://www.mkssoftware.com/docs/man1/snmpusm.1.asp which also describes how to create a user and change the Passphrase of a user with snmpusm.

EDIT: My bad, I didn't notice that the /var/net-snmp/snmpd.conf actually contained more lines than what vim displayed without scrolling. The "usmUser" lines that Ashwin mentions are there. I haven't tried to remove the lines, but I assume that would work as well.

Community
  • 1
  • 1
zpon
  • 1,328
  • 1
  • 13
  • 21