I was forwarded a great cartoon today. It depicts a stick figure using the sudo command on another stick figure with an effect not unlike Obiwan telling that stormtrooper "These are not the droids you're looking for". I was so tickled by this cartoon that I had to try and share the humor with my wife. Of course I had to start by explaining that sudo is a command used to elevate a UNIX user's privilege so that they can safely run commands as the dangerous root user without the risk of remaining root for fear of mucking up the system. It didn't work, and I had to be content in chuckling to myself.
This reminded me of a little script that I used to use when I needed to use sudo repeatedly and didn't want to retype my password every 5 minutes, as is the default behavior of sudo. I called the script 'frankensudo', perhaps because it keeps bringing sudo back to life.
#!/bin/bash
franken () {
/usr/bin/sudo -v
/bin/sleep 275
}
while true ; do
franken
done
I would invoke this script in the background with:
./frankensudo &
Of course, this is a bit sneaky and only slightly defeats the purpose of sudo. After all you still need to type the word sudo to run a command. You just won't have to re-authenticate.