#!/bin/sh
# Change permissions, links so that a group of users can access the
# diagnostic commands.

COMMANDS="traceroute tcpdump statnet netwatch trafshow"

if [ "x$1" = "x" ]; then
  echo "Usage: diagperm <group allowed access to diagnostic commands>"
else
 if grep -q $1 /etc/group; then
  for i in $COMMANDS; do
	if [ -x /usr/sbin/suidregister ]; then
		suidregister /usr/sbin/$i root $1 4754
	else
		chgrp $1 /usr/sbin/$i
		chmod 4754 /usr/sbin/$i
		ln -s ../../sbin/$i /usr/local/bin
	fi
  done
  echo "Permissions enabled for members of group $1"
 else
   echo "Group $1 not in /etc/group."
 fi
fi
