On Sun, Apr 18, 2010 at 07:55:31PM -0700, John Jason Jordan wrote: > #! /bin/bash > su #'cause only root can set the time > ntpdate 0.pool.ntp.org > hwclock --systohc > > When I try to run it as jjj it asks for root password, I enter it, > and then I get an authentication error. If I change to root first and > then run it, it runs fine, and without prompting for root password. > > It must be the su line. How do I make a script run as root? Or can I > fiddle with the permissions so jjj has permission to set the time, then > just remove the su line from the script and forget about running it as > root?
Choices, choices, choices Change the script to: #!/bin/bash sudo ntpdate 0.pool.ntp.org sudo hwclock --systohc or Change the script to: #!/bin/bash ntpdate 0.pool.ntp.org hwclock --systohc and invoke it by `sudo <script_name>` or su crontab -e <insert line in crontab to have root run the script once every X> exit or sudo chown root <script_name> sudo chmod +x <script_name> sudo chmod u+s <script_name> The last one is what you asked for. -- Michael Rasmussen, Portland Oregon Trading kilograms for kilometers since 2003 Be appropriate && Follow your curiosity http://www.jamhome.us/ The Fortune Cookie Fortune today is: You recoil from the crude; you tend naturally toward the exquisite. _______________________________________________ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug