A Sudo Example — I Can Not Believe I Missed This One

sudo make me a sandwich from http://store.xkcd.com/

I came to Ubuntu from Fedora. By default, Red Hat based systems don't have sudo set up (or didn't) on new installs, so it was quite a change when I landed in UbuntuLand, where the people think su – is a terrible idea. While I disagreed for a long time, I can now think of a sudo example that has changed my mind.

June 11, 2012

I never liked sudo.  It's only four extra letters, but typing it whenever I needed to get a sysadmin task completed got old quick.  One of the first things I did after installing Ubuntu on any of my computers was to give a password to root.  sudo passwd is the command for getting that done by the way (you enter your own password, then root's new one twice) but I wouldn't recommend it.  Yes, prefacing every command with it when you need to get something done is kind of a pain, but there's another way.

What I discovered, after running to Fedora16, was that sudo -i allows me to have a root shell without having a root password.  This command has always been there, I just didn't know about it.  I learned Linux on Fedora and Cent, and so the only sudo I ran across was on distro independent message boards and some application documentation.

Having such a "root shell" open is so handy for when I've got to run a bunch of commands in a row as root.  I'm still kind of dumbfounded that I never knew about sudo -i until lately.  Oddly enough, there are a few other things I only recently realize I could do, like rearrange open tabs in Firefox, run commands as another user on the same box (ssh -Y me@localhost command after installing ssh-askpass-gnome) and a few others I just happened to discover somehow.

The simple sudo example of sudo -i though is by far the biggest "Well, DUH!" moment I've had since that time I couldn't find a forward slash in a php file for a couple of hours…

Leave a Reply

Your email address will not be published. Required fields are marked *