"su: must be run from a terminal" How best for root to run command as user
I have a script that runs as root and needs to execute a command as another user. However, it seems that newer versions of su won't let me do that. I get the message...
"su: must be run from a terminal"
I can understand the security issue of allowing a normal user to su when not in a terminal, but why is root blocked from running as a normal user??? Is there any reason why there is not an excemption for root?
The command I would like to run is to check Zimbra status for nagios/nrpe.
su - zimbra -c "zmcontrol status"
Is there any workaround to enable root to execute the above command?
I've just realised that the script wasn't being run as root. So it obviously wouldn't work!
Last edited by simonb; 03-31-2012 at 10:06 AM.