This is on a CentOS machine. I'm trying to run a script as user nobody (or as a user with minimal permissions) at a certain time every day. Here is nobody:
[root@CentOS % ~] grep "^nobody" /etc/passwd nobody:x:99:99:Nobody:/:/sbin/nologin
here's what I've tried in root's crontab:
setting the Environment variable SUDO_USER=nobody
15 17 * * * sudo -u nobody /bin/bash /usr/local/bin/bashscript.sh
15 17 * * * su -c /usr/local/bin/bashscript.sh nobody
I'd like to keep the crontab entry in root's crontab if at all possible. I'd also prefer not fooling with user nobody's account, as I don't want to break anything else that might rely on those settings. I'm not adverse to creating another non-privileged account and giving them a real shell if that's the sticking point.
I'll also admit to being a bit perplexed. I would assume this would be an everyday issue, except my brown belt in google-fu isn't helping much.