`if [ "${USER}" == "nobody" ]; then`
should be
`if [ "${WEBUSER}" == "nobody" ]; then`
right?