通过代理删除 snmp 中的用户

发布于 2024-11-26 17:53:08 字数 183 浏览 1 评论 0原文

我可以快速完成 snmp 安装并且工作正常。

在代理模块之一中,我目前正在研究并尝试修改源代码。我遇到了一个问题,我需要通过代理删除用户。

坚持完成这个:

就像 net-snmp-create-v3-user 在服务器端创建用户的方式一样,我想知道是否有类似的东西可以删除用户。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

相思故 2024-12-03 17:53:08

根据我的理解,net-snmp-create-v3-user 只需执行以下操作:

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

中添加新用户数据之前,应停止 snmpd。 conf 文件。

相当于 net-snmp-create-v3-user,删除用户的操作类似:

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

usmUser 字段不是可打印字符,而是表示为十六进制字符串。它们根本就没有加密。

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.

深居我梦 2024-12-03 17:53:08

我刚刚遇到了类似的问题。我已经添加了一个用户,想再次删除它。但是,net-snmp 从 /var/net-snmp/snmpd.conf 文件中删除 安全原因,因此 Ashwin kumar 的答案对我不起作用(*参见下面的编辑)。

snmpusm 有一个delete 选项,可用于删除用户。 snmpusm 需要另一个用户验证 delete 请求(我没有测试过,但我假设其他用户必须具有 RW 访问权限)。以下示例使我能够从我的 snmp 配置中删除用户:

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

此解决方案的灵感来自此页面 http://www.mkssoftware.com/docs/man1/snmpusm.1.asp 其中还描述了如何创建用户并更改用户的密码snmpusm

编辑:我的错,我没有注意到 /var/net-snmp/snmpd.conf 实际上包含的行数比 vim 在不滚动的情况下显示的行数还要多。 Ashwin 提到的“usmUser”行就在那里。我没有尝试删除这些行,但我认为这也可以。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文