RogerBW's Blog

Why not a root shell? 09 February 2016

Many modern Linux systems assume that you will never have a root shell. Instead, you are expected to prepend "sudo" to every root-type command.

This is a safety measure, and I can appreciate that. But it seems to give up a great deal of capability (for example, the ability to scan down a file hierarchy and tab-complete a long boring device name rather than typing it out in full) in return for that.

The SR-71 pilots used to say that if you weren't just a little bit scared getting into the cockpit, it was time to retire. That's the way I feel about a root shell: it's scary, and it should be. You can destroy the entire machine with a single command. But that's why you're running Unix in the first place: a tungsten-carbide disc grinder will cut through more things than a pair of plastic safety scissors, and those things need not include your hand.

I suppose sudo is fine for copying and pasting someone else's recipe (though if you're doing that you're effectively trusting them with your machine anyway), or for doing a set of standard configuration commands when you're setting up a particular bit of software. But for troubleshooting, where you may well need to have multiple rooty processes running and talking to each other, it feels like just a waste of keystrokes.

(The modern sysadmin approach of rebuilding the machine image from scratch, rather than trying to work out why it went wrong and fix it… is a subject for a separate rant.)

If you're running your own system rather than following someone else's instructions, you'll simply get into the habit of prepending sudo to certain commands. There will be nothing unusual about it, no frisson to remind you that you're playing with the grown-ups now. Make fear work for you: the # prompt can be a useful red flag.

  1. Posted by John Dallman at 12:31pm on 09 February 2016

    While I agree with you, it isn't the modern style. I'd be perfectly happy with an OS where I had to take a few steps to make a root shell available, so that it wasn't automatically there as a trap for the unwary.

  2. Posted by Owen Smith at 01:56pm on 09 February 2016

    I'm a relative novice with Linux and yet I login to my Pi as root. Having to type sudo on the front of everything just gets in the way frankly. And I'm used to the fear of being logged in as root, we did that at my job 20 years ago on FreeBSD and SCO (spit). Though there for traceability the advice was to login as yourself and then su to root given there were five of us using the same servers.

  3. Posted by RogerBW at 03:02pm on 09 February 2016

    I don't mind putting a root shell out of easy reach (e.g. by su and password, confirmation box, or similar); I certainly don't want to spin one up by accident. But I still prefer the actual shell running as root rather than a one-line-at-a-time interface.

Comments on this post are now closed. If you have particular grounds for adding a late comment, comment on a more recent post quoting the URL of this one.

Tags 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000s 2010s 3d printing action advent of code aeronautics aikakirja anecdote animation anime army astronomy audio audio tech aviation base commerce battletech beer boardgaming book of the week bookmonth chain of command children chris chronicle church of no redeeming virtues cold war comedy computing contemporary cornish smuggler cosmic encounter coup covid-19 crime cthulhu eternal cycling dead of winter doctor who documentary drama driving drone ecchi economics en garde espionage essen 2015 essen 2016 essen 2017 essen 2018 essen 2019 essen 2022 essen 2023 existential risk falklands war fandom fanfic fantasy feminism film firefly first world war flash point flight simulation food garmin drive gazebo genesys geocaching geodata gin gkp gurps gurps 101 gus harpoon historical history horror hugo 2014 hugo 2015 hugo 2016 hugo 2017 hugo 2018 hugo 2019 hugo 2020 hugo 2022 hugo-nebula reread in brief avoid instrumented life javascript julian simpson julie enfield kickstarter kotlin learn to play leaving earth linux liquor lovecraftiana lua mecha men with beards mpd museum music mystery naval noir non-fiction one for the brow opera parody paul temple perl perl weekly challenge photography podcast politics postscript powers prediction privacy project woolsack pyracantha python quantum rail raku ranting raspberry pi reading reading boardgames social real life restaurant reviews romance rpg a day rpgs ruby rust scala science fiction scythe second world war security shipwreck simutrans smartphone south atlantic war squaddies stationery steampunk stuarts suburbia superheroes suspense television the resistance the weekly challenge thirsty meeples thriller tin soldier torg toys trailers travel type 26 type 31 type 45 vietnam war war wargaming weather wives and sweethearts writing about writing x-wing young adult
Special All book reviews, All film reviews
Produced by aikakirja v0.1