LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "su: must be run from a terminal" How best for root to run command as user (https://www.linuxquestions.org/questions/linux-newbie-8/su-must-be-run-from-a-terminal-how-best-for-root-to-run-command-as-user-937409/)

simonb 03-31-2012 08:59 AM

"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?

Thanks

Update:
I've just realised that the script wasn't being run as root. So it obviously wouldn't work!

Please ignore

druuna 04-01-2012 02:40 AM

Good to see you figured out what was wrong and added this info to your thread.

Ignoring it by taking this of the zero reply list......


All times are GMT -5. The time now is 11:46 PM.