Fri 26 May 2006
Over the past few weeks I’ve been getting annoyed with the distributed.net client while doing cpu intensive things. Its easy enough to su, /etc/init.d/dnetc stop.. but even that can get to be a bit much. I figured an icon would be much nicer. The issue then, is allowing me as a regular user to operate init.d scripts.
Now I’ve tried using chmod+s before and had some success, but it didn’t seem to be working here, plus thats not really the right way of doing it. It turns out configuring sudo for this task is really simple.
Simply type a
visudo
And you’ll see the /etc/sudoers file (must use visudo though..)
I then added
User_Alias RANDOM = random
and
Cmnd_Alias CMD_DNETC = /etc/init.d/dnetc
Then gave myself the permissions with the following entry
RANDOM ALL = NOPASSWD: CMD_DNETC
Obviously the aliases weren’t required in this simple configuration, but I figured I might as well do it right, as I’m sure I’ll start to use this more now that I know how. The NOPASSWD option makes it so sudo doesn’t ask me for my user password (how useless would that be?). Now I can run the command as a user by simply typing (or pointing an icon to)
sudo /etc/init.d/dnetc
Works like a charm.