Created
April 29, 2017 17:12
-
-
Save jwieder/fef3615791ef3bc307cdc4a4077bca36 to your computer and use it in GitHub Desktop.
A simple shell script that will restore the permissions to fping & fping6 required by Zabbix following an update or other system change. I use this as part of a daily cron. NOTE: this is designed for RHEL/CentOS, and assumes that you are running Zabbix from a group named "zabbix".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
x=0 | |
y=0 | |
if [ -e /usr/sbin/fping ] | |
then | |
if [ `stat -c %a:%G /usr/sbin/fping` == "6710:zabbix" ] | |
then | |
echo "Sticky bit assigned and owner set" | |
else | |
echo "Permissions incorrect for fping, fixing" | |
chown root:zabbix /usr/sbin/fping | |
chmod 710 /usr/sbin/fping | |
chmod ug+s /usr/sbin/fping | |
fi | |
else | |
echo "fping does not exist in /usr/sbin/" | |
x=1 | |
fi | |
if [ -e /usr/sbin/fping6 ] | |
then | |
if [ `stat -c %a:%G /usr/sbin/fping6` == "6710:zabbix" ] | |
then | |
echo "Sticky bit assigned and owner set" | |
else | |
echo "Permissions incorrect for fping6, fixing" | |
chown root:zabbix /usr/sbin/fping6 | |
chmod 710 /usr/sbin/fping6 | |
chmod ug+s /usr/sbin/fping6 | |
fi | |
else | |
echo "fping6 does not exist in /usr/sbin/" | |
y=1 | |
fi | |
if [ y -eq 1 ] | |
then | |
if [ x -eq 1 ] | |
then | |
exit 2 | |
else | |
exit 1 | |
fi | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment