Bringing a Windows mindset to a GNU/Linux world
Thursday, June 12th, 2008I just ran across a level of stupid so off the charts I had to immediately comment on it here lest my inaction unwittingly foster an environment tolerant of such stupidity. Allow me to quote from a post on Linuxforums:
When I say cd’d I mean I used the command cd, to change directory.
So for example say I downloaded and extracted the drivers to the desktop I would open a Konsole window and type:
sudo cd /home/sebmaster/desktop/[folder extracted to]/
(You probably dont need sudo but I have got into the habit of adding it before pretty much everything)
Those of you are familiar with GNU/Linux should see this heaping mound of stupidity for what it is immediately, and will likely find the following explanation superfluous. For the rest of you, here’s a detailed explanation.
There are two distinct nexuses (nexi?) of stupidity inherent in this quote. The first is the notion that sudo, a wrapper program that executes the program passed to it as an argument with root (adminstrator) privileges, will do anything with the change directory command. It won’t. Cd is a shell command; it is not a program. Sudo can’t even find it. The exact error message I get is “sudo: cd: command not found”. And even if cd was a program, using it in this way wouldn’t do anything, since the new working directory would be lost when the sudo subshell terminated. And even if that did work, it still wouldn’t be useful, because there’s no point in setting your working directory to a directory you don’t have access to anyway. You’re still going to need to use sudo with every subsequent command just to get access to those files, so the sudo cp is superfluous; just skip the cd altogether and use a qualified path to the files.
But that’s not even touching on the second (and greater) nexus of stupidity, which is the very-Windows-like mindset that everything should be run as administrator. Saying “You probably dont need sudo but I have got into the habit of adding it before pretty much everything” is like saying “You probably don’t need a live hand grenade but I have got into the habit of carrying one around with me everywhere I go.” Like a live hand grenade, sudo is potentially very dangerous, as the root account has total access to the system (so simple mistakes or security compromises become far worse than they would with mere user account permissions). The mantra to live by is: Never run anything as root unless it is absolutely necessary. As soon as I read that this faithful deliverer-of-the-stupid executes pretty much everything as root out of force of habit, I stood up from my computer, placed my hand over my face, and let out a very long, exasperated sigh. Why doesn’t he just su at the beginning of every terminal session and get it over with?
Oh wait, I probably shouldn’t have said that. He’s probably going to read that last bit, miss all the rest of the content in this post, and think that’s a good idea. “Hey, now I don’t even have to type sudo anymore, because everything I do is always as root!” Yes, even changing directories.