Remove User in snmp by agent
Asked Answered
S

2

6

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.

Stlaurent answered 25/7, 2011 at 16:35 Comment(0)
P
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.

Pasha answered 26/7, 2011 at 0:6 Comment(0)
S
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.

Stites answered 4/12, 2014 at 19:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.