Bash fun - sudo insults and locomotives

Don't you ever get the feeling that your computer is too nice? No? Never mind. Basically, this is just the howto for letting sudo use your user password instead of the root one.

If you haven't done that already, configure your user account for sudo in YaST:
1. Security and Users -> Group management: add your account to the "trusted" group
2. Security and Users -> Sudo: in the Add... dialogue, choose your account under "User" and the value ALL for all other input lines.

Regrettably, in the standard SuSE installation sudo still doesn't accept your password.
Edit the sudoers file:
sudo vi /etc/sudoers
Comment out the lines under "When configuring sudo, delete the two following lines:", should look like this:

# Defaults targetpw
avocadohead ALL = (ALL) ALL

Oh, and if you add the line Defaults insults somewhere in the file, the shell gets really bitchy when you type the wrong password.
Reset your sudo session with sudo -K to try them out.

HowTo customise the insults list in theory (do this at your own risk and make sure you know the root password): Unlike many other linux packages, the insults list is hard-coded into the sudo executable (to prevent wanton discrimination and trollities, I suppose). Get the sources; various types of insults are listed in the ins_*.h files. Write your own ins_custom.h file and adapt all # include, # define and # ifdef statements in the respective source files. Configure (--with-all-insults), make and install. If you broke a previously untainted sudo with this, at least you ought to have some really fine insults ready by now. Apply them fittingly and try re-installing in YaST from a proper root shell.

A propos typos: On our old Linux cluster we had a gimmick for people typing sl instead of ls - the Ascii steam locomotive.
Download the source tarball and extract.
tar -xf sl.tar
cd sl

Switch compiler lines in the Makefile (move the comment sign to the line referencing libtermcap) and change the lcurses flag to lncurses:
# $(CC) $(CFLAGS) -o sl sl.c -lcurses -ltermcap
$(CC) $(CFLAGS) -o sl sl.c -lncurses

Compile with make, and copy sl where Linux can find it:
sudo cp sl /usr/bin/

Try the options sl -l and sl -a ...

No comments: