September 2013 Archives

Using Super to Automate Tasks

The super package, available in Debian and its derivatives, can be used to automate many tasks requiring root privileges to run.

Install the package and edit the configuration file:

~$ sudo nano /etc/super.tab
Add these lines to the end of the file:
update  "/usr/bin/apt-get    update"   martin  u+g=root
upgrade	"/usr/bin/apt-get -y upgrade"  martin  u+g=root \
 setenv=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Now it's possible for me, an ordinary user, to execute the update/upgrade prosess without the use of su or sudo:

~$ super update
~$ super upgrade

Root Password with Ubuntu

Ubuntu and probably a lot of other distributions do not allow you to set a root password. Instead they encourage users to use sudo.

This irritates me greatly, and the way to set a known password for root is to use sudo itself, together with passwd:

~$ sudo passwd
[sudo] password for martin: <I type my own password>
Enter new UNIX password: <I type root's new password>
Retype new UNIX password: <I re-type root's new password>
passwd: password updated successfully

This updates root's password and needless to say you should use a long and complex string of characters.