[clug-talk] Setting Time Programatically without being root

Aaron Seigo aseigo at kde.org
Tue Nov 30 16:17:38 PST 2004

On November 30, 2004 17:05, Evan Brown wrote:
> restarts we want to be able to set the system time. We don't want to log
> into linux as root, but we need to set the time. Whats the format to run
> a command as root without having to su? We're not pumped at putting the
> password for su in the program but if that's the case me may just do it.

2 options jump to mind:

0. sudo. however, as this seems to be an embedded device you are working on 
the overhead (disk, ram and cpu) is probably undesirable

1. suid. make the binary suid root and off you go. as root just do a `chmod 
+s /path/to/file`. normally this is a mildly dangerous thing to do as you are 
now allowing anyone to run that binary effectively as root. however, as long 
as the binary itself is Secure and it can't be overwritten, potential 
problems are lowered. given that this is an embedded device, you probably 
don't have any human users actually interacting directly with the device 
anyways, so the risks are lowered even further.

generally, you want to keep suid binaries to a minimum, but there are times 
when its the best, or even only, choice. which is why suid exists in the 
first place =)

Aaron J. Seigo
Society is Geometric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/clug-talk_clug.ca/attachments/20041130/9096816c/attachment.bin

More information about the clug-talk mailing list