I've attached a patch that solves the problem by creating a group
named snmp. It's my first patch ever for Debian so please be gentle...
but also cautious.

Alex
diff -u net-snmp-5.4.1~dfsg/debian/snmpd.postrm net-snmp-5.4.1~dfsg/debian/snmpd.postrm
--- net-snmp-5.4.1~dfsg/debian/snmpd.postrm
+++ net-snmp-5.4.1~dfsg/debian/snmpd.postrm
@@ -10,10 +10,19 @@
     rm -f /var/run/agentx
     rm -f /var/run/snmpd.pid
     rm -f /var/run/snmptrapd.pid
-    if [ -x /usr/sbin/deluser ]; then
-      deluser --quiet --system snmp
-    else
-      echo "Can't remove user snmp. Please remove this user by hand."
+    if getent passwd snmp >/dev/null; then
+	if [ -x /usr/sbin/deluser ]; then
+	    deluser --quiet --system snmp
+	else
+	    echo "Can't remove user snmp. Please remove this user by hand."
+	fi
+    fi
+    if getent group snmp >/dev/null; then
+	if [ -x /usr/sbin/delgroup ]; then
+	    delgroup --quiet --system snmp
+	else
+	    echo "Can't remove group snmp. Please remove this group by hand."
+	fi
     fi
 fi 
 
diff -u net-snmp-5.4.1~dfsg/debian/changelog net-snmp-5.4.1~dfsg/debian/changelog
--- net-snmp-5.4.1~dfsg/debian/changelog
+++ net-snmp-5.4.1~dfsg/debian/changelog
@@ -1,3 +1,10 @@
+net-snmp (5.4.1~dfsg-12.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * snmpd no longer runs as group root but as snmp (Closes: #520724)
+
+ -- Alexandru TUDOR <alex.tu...@gmail.com>  Thu, 22 Oct 2009 18:24:45 +0200
+
 net-snmp (5.4.1~dfsg-12) unstable; urgency=high
 
   * Urgency high because of RC bug fix.
diff -u net-snmp-5.4.1~dfsg/debian/snmpd.postinst net-snmp-5.4.1~dfsg/debian/snmpd.postinst
--- net-snmp-5.4.1~dfsg/debian/snmpd.postinst
+++ net-snmp-5.4.1~dfsg/debian/snmpd.postinst
@@ -3,8 +3,8 @@
 set -e
 
 if [ "x$1" = xconfigure ]; then
-	adduser --quiet --system --no-create-home --home /var/lib/snmp snmp
-	chown -R snmp /var/lib/snmp
+	adduser --quiet --system --group --no-create-home --home /var/lib/snmp snmp
+	chown -R snmp:snmp /var/lib/snmp
 fi
 
 . /usr/share/debconf/confmodule
diff -u net-snmp-5.4.1~dfsg/debian/snmpd.default net-snmp-5.4.1~dfsg/debian/snmpd.default
--- net-snmp-5.4.1~dfsg/debian/snmpd.default
+++ net-snmp-5.4.1~dfsg/debian/snmpd.default
@@ -8,7 +8,7 @@
 SNMPDRUN=yes
 
 # snmpd options (use syslog, close stdin/out/err).
-SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
+SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
 
 # snmptrapd control (yes means start daemon).  As of net-snmp version
 # 5.0, master agentx support must be enabled in snmpd before snmptrapd

Reply via email to