if [ "$(stat -c "%a" /etc/crontab)" == "644" ]
then
echo "Is there a vulnerability: No, Permission set on /etc/crontab file is correct."
else
echo "Is there a vulnerability: Yes, Permission set on /etc/crontab file is incorrect. echo awk -F: $(stat -c "%a" /etc/crontab)"
fi
This is an audit script i am working on, and I would like to output the current Permissions of the /etc/crontab file, if it is not equals to chmod 644. I've tried many methods to no avail. I am doing this in a RHEL 7 server if it matters.