Slashdot Mirror


Sudo vs. Root

lessthan0 writes "In Mac OS X, the root account is disabled by default. The first user account created is added to the admin group and that user can use the sudo command to execute other commands as root. The conventional wisdom is that sudo is the most secure way to run root commands, but a closer look reveals a picture that is not so clear." The article is about OSX but the debate is a little older ;)

327 comments

  1. Layered Security by Mattygfunk1 · · Score: 4, Informative
    The conventional wisdom is that sudo is the most secure way to run root commands, but a closer look reveals a picture that is not so clear.

    The article doesn't say that sudo isn't the most secure way to run commands, it just details how to make it even more secure.

    1. Re:Layered Security by Jason+Hood · · Score: 5, Insightful

      I honestly feel dumber for RTFA.

      --
      Are you intolerant of intolerant people?
    2. Re:Layered Security by Anonymous Coward · · Score: 1, Informative

      The article is fucking stupid for another reason; it says sudo is 'insecure' because, if you're logged in as admin, you don't the username, just the password. How exactly does root make this any more secure? You already know the username for root is 'root', so whats the fucking difference? Either way its all just a password away...

    3. Re:Layered Security by BrianPan · · Score: 4, Funny

      What in the world are you doing reading the articles on Slashdot? Who does that?

    4. Re:Layered Security by dotgain · · Score: 1
      You actually can change the username from "root", just as you can change "Administrator" in Windows (thank God, it's a PITA to type all the time).

      Many truly stupid people think they're making themselves more secure by doing so, it was policy in one place I worked to change "Administrator" to some obscure word. Of course, that word was always left in the username box, and many users asked me who it was with that username, so it's not like it got kept very secret.

    5. Re:Layered Security by Zerathdune · · Score: 2
      I think you missunderstood. what he was saying was that since you use the same password for sudo as for your user account, to gain root privelages through sudo, you only need to crack one password, whereas if you use root logins, and disallow them directly (allowed only through su,) you need to crack two passwords instead of just one.

      of course, as he said, there are ways of making this also the case with sudo, but they take away any advantage it offers.

      --
      No single raindrop believes that it is responsible for the storm.
    6. Re:Layered Security by Ndiin · · Score: 1
      I agree. I especially love this:

      "They still have to guess the root password. Of course, if they have a local account, they may be able to use a privilege escalation vulnerability to gain root access, but that is an issue for Apple."

      ...of course, if they're running sudo, they already have a local account. Privilege escalation's not going away any time soon, either.

  2. Obviously root wins by Anonymous Coward · · Score: 0

    I mean, it's like rock vs. scissors.

  3. I guess that this article can be skipped by zappepcs · · Score: 1, Troll

    I guess that this article can be skipped if you are a windows user? :)

    1. Re:I guess that this article can be skipped by terraformer · · Score: 1

      Word has it that Vista will change that and there will be sudo like capabilities but I suspect it is too soon to tell if it will materialize and if so, in what form.

      --
      Who are you? The new #2 Who is #1? You are #617565. I am not a number, I am a free man! Muhahaha.
    2. Re:I guess that this article can be skipped by Anonymous Coward · · Score: 0

      Are you trying to be funny or is that just your normal way of observing things?

      Yes, we all know about winsudo. No, you were not clever.

    3. Re:I guess that this article can be skipped by firl · · Score: 0

      well its not just for mac os, many things, livecd's that are debian based. Windows vista also has a slightly different take, it just pops up a dialog box everytime it wants to do something admin like. which is cool, except it doesn't give full admin which I guess is a step forward for windows. but if you want to change file permissions on a kernel file you should be able to without being forced to reboot to a recovery console, can do this in bsd and linux variants.

    4. Re:I guess that this article can be skipped by jginspace · · Score: 1

      I guess that this article can be skipped if you are a windows user? :)

      Check out the excellent Nonadmin site:

      http://nonadmin.editme.com/WinSUDO

      Lots of useful stuff there that not many people know about...

    5. Re:I guess that this article can be skipped by ThePhilips · · Score: 2, Interesting

      Well you already can tell Windows (starting from w2k) to launch application under another account. Thou most Wind0ze applications can't that. It's not the problem of applications - it's that the windows api expects all the fancy stuff - like desktop and registry - to be present and set up for the user. Conventional apps rarely run okay that way - several admin applications run that way w/o problems.

      Try it. Right click on the link to application or application itself and select "Run As". (Also you can hold "shift" button on right click - that way Wind0ze' Explorer would display complete right-click menu for the target, "Run As..." would be definitely there).

      Note that under *nix, it's security feature to run application w/o bells and whistles. It's almost impossible to run them otherwise. Under Windows, due to mandated GUI, applications are always "fatter" compared to their *nix counterparts. In Unix world it's norm to have GUI running in unpriviliged mode and then pass user commands to small back-end tool running with all required priviliges. One can compromise the front-end - but still privileged back-end would dissmiss any disallowed command. For some unknown reason I rarely see such approach being used on windoze.

      --
      All hope abandon ye who enter here.
    6. Re:I guess that this article can be skipped by gcauthon · · Score: 1

      First of all, windoze does not have a "mandated GUI". You are free to write console-based apps in windows. I'm not sure what all of that "right click" and "run as" crap is either. Just drop to a console and type "runas /usr:admin ". You can use the switch "/profile" or "/noprofile" to control whether the "fancy stuff like desktop and registry" (which I'm assuming you mean the user's profile) are loaded. If you absolutely must use the mouse, then just create a script file and then create a shortcut to it on your desktop.

      Second, how exactly do you define a privileged account? If you define it as the account responsible for running system-level processes, then it seems logically impossible to run a system process like XDM as anything but a privileged account. If you run XDM as "joe", then "joe" would implicitly become a privileged account.

    7. Re:I guess that this article can be skipped by sconeu · · Score: 1

      The problem is that you have to give out the Admin password. There's no equivalent to setuid to up the privilege.

      --
      General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
    8. Re:I guess that this article can be skipped by ckaminski · · Score: 1

      When will windows finally allow user impersonation? I'm tired of having to change user passwords to properly prep a laptop with domain accounts for my field sales people. I certainly can't figure out a better way to do it that's painless for THEM.

    9. Re:I guess that this article can be skipped by drsmithy · · Score: 1
      When will windows finally allow user impersonation?

      Probably never. It's a rather large hole from a security/auditing perspective.

  4. Oh, great! by Len+Budney · · Score: 4, Funny

    Now all the black-hats out there will have a powerful new tool in their arsenal! You mean, a sudoer can, like, type "sudo /bin/bash" and then do all sorts of things as root? Pretty irresponsible of him to go telling the world a secret like THAT!

    1. Re:Oh, great! by Phreakiture · · Score: 2

      I'm going to be even more irresponsible and invoke our good friend Tim Towtdi....

      • sudo /bin/bash
      • sudo su -
      • sudo -s
      --
      www.wavefront-av.com
    2. Re:Oh, great! by Anonymous Coward · · Score: 0

      "You mean, a sudoer can, like, type "sudo /bin/bash"

      He wouldn't even waste the key strokes

            $ sudo -i


    3. Re:Oh, great! by diegocgteleline.es · · Score: 3, Interesting

      Well, and what happens if it's a application being compromised who runs sudo?

      I've never liked that "security measure" in mac os x or ubuntu. Take a IM app or browser. Find a bug in it, and exploit the hole by running "sudo rm -rf /".

      AFAIK there's nothing stoping that from happening? What that tells to my head is "you can do anything as root by using sudo". How can that be called "security"? I use a shared computer between several people and the first thing I do is to run "sudo passwd" because, well, other person could do it if I don't do it before him.

      If it doesn't have a password, I don't trust it. sudo just helps people to jump walls that they're not supposed to be able to jump.

    4. Re:Oh, great! by Anonymous Coward · · Score: 0
      If it doesn't have a password, I don't trust it. sudo just helps people to jump walls that they're not supposed to be able to jump.
      sudo does have a password, by default.
    5. Re:Oh, great! by diegocgteleline.es · · Score: 1

      not in ubuntu, for sure.

    6. Re:Oh, great! by GoingDown · · Score: 5, Insightful

      When running "sudo rm -rf /" it still asks user's password if that user has not ran sudo before on that same environment. In Ubuntu, only FIRST user account created during installation is able to do sudo by default, rest of the accounts are not in wheel group and are not permitted to sudo. Root account is disabled, it is not "account without a password". So, you need to know password of wheel user to be able to use it.

    7. Re:Oh, great! by das_cookie · · Score: 2, Informative

      Bottom line is that the only thing sudo *REALLY* buys you is the ability to log who did what when with root access. And as has been pointed out, there are innumerable ways to circumvent even that (sudo vi; :!sh). It's a way to keep honest folks honest and have a way to go ask someone what they were trying to do; I've also used it for myself to create session logs for audit purposes. Someone bent on nefarious uses can easily cover their tracks.

      --

      You! Yes, YOU! Out of the gene pool!

    8. Re:Oh, great! by TravisWatkins · · Score: 1

      Not true. When you use sudo you have to put in your password. But for (I think) 5 minutes after that sudo works without a password.

      --

      "But I'm still right here, giving blood and keeping faith. And I'm still right here."
    9. Re:Oh, great! by Knuckles · · Score: 2, Interesting

      I've never liked that "security measure" in mac os x or ubuntu

      As far as Ubuntu is concerned (dunno about OSX) it never was about security, or at least not in an abstract way, "what's more secure: root or sudo?". This is one of those myths that get perpetuated on mailing lists, /. and whatnot and drive me crazy. Someone misunderstood, and since then the myths refuses to die. Everyone writing about this topic should be forced to read the article on Ubuntu Wiki

      Sudo in Ubuntu was done for one thing: convenience. The user (assumed to be dumb, and rightly so) should only have password. The system would ask (via gksudo) for this one password whenever it needs admin access. Now, in the case of a dumb user who who doesn't graps the root concept, I do believe that sudo is more secure, but that is a side effect.

      --
      "When I first heard Daydream Nation it quite frankly scared the living shit out of me." -- Matthew Stearns
    10. Re:Oh, great! by Excelsior · · Score: 2, Insightful

      If it doesn't have a password, I don't trust it. sudo just helps people to jump walls that they're not supposed to be able to jump.

      Okay, wrong. Sudo still involves a password. Only allowed "sudoers" are able to run sudo, and they are prompted for a password. Sudo, in my humble experience, actually is more secure simple because of human nature. And here's why:

      1) In distributions that expect you to use root, users tend to leave a terminal logged into root all the time. With sudo, there's an automatic timeout. If you walk away from the computer, the root permission gets locked.

      2) Each command that needs to be run as root must indivually prephased with "sudo". So, users naturally tend to only run things as root that really need to be run as root. Without sudo, users keep a terminal logged in as root, and run a series of commands in that terminal, many of which didn't need root access (ala, someone coming into an irc channel as root).

      3) Multiple admins on the same system aren't sharing a password.

      4) Sudo can log who ran what commands. When someone screws something up logged in as root, there's no way to know who it was on a multi-admin system.

    11. Re:Oh, great! by Creepy · · Score: 1

      people have already mentioned that sudo requires a password, which is the default (look in /etc/sudoers - also notice that you can turn it off), but there is another advantage to using "sudo" as opposed to root:

      Say you're running IM - the process is run as your user not root. If that process is exploited, the hacker is in as your user, but still doesn't know your password. Yes, they could set up a key logger and other hacker tricks, but at that point it's watch and wait for them, not a direct exploit. There are even other issues - most hackers compile the programs on the target machine once they get in and that isn't possible unless the mac had the dev disk installed.

      Some users, like www (the default apache user - the root process spawns www user processes to handle web actions) have limited permissions. If you want to go extreme, you could even restrict global write access by that user through ACLs (though I'm not sure if ACLs pre-empt directories like /tmp that have the sticky bit set)

      Some people argue that you should have a root user with a root password, but I think it's more important to make sure all administrators use a good password, and better to have one hard to remember password than two easy ones. If you feel that's not enough, it's also possible to restrict what exactly the sudoer can do - try man sudoers or info sudoers from a command prompt.

    12. Re:Oh, great! by hackstraw · · Score: 1

      Well, and what happens if it's a application being compromised who runs sudo?

      I've never liked that "security measure" in mac os x or ubuntu. Take a IM app or browser. Find a bug in it, and exploit the hole by running "sudo rm -rf /".
      ...

      AFAIK there's nothing stoping that from happening?

      If it doesn't have a password, I don't trust it.


      From what I know, sudo by default always asks for a password. I've seen it with a bootable CD Linux distro, where it didn't, but even then, it was safer having sudo without a password on a single user system not running as root, than running as root.

      Keep in mind, that, what? About 90% of the computers out there run most all, if not all applications, including insecure web browsers with Administrator (aka root I guess in Windows) permissions.

      *NIX, OS X, etc where sudo is involved are already in the top 10% of security of the systems out there if you look at the big picture.

    13. Re:Oh, great! by caluml · · Score: 1
      In distributions that expect you to use root, users tend to leave a terminal logged into root all the time.

      Do what I do on my servers: In /etc/profile:
      TMOUT=3600
      typeset -r TMOUT
      It sets a read-only variable which is the bash timeout. Sure, people can start another shell and get around the reading of /etc/profile, but it is useful if you work with people that like to remain logged in.

    14. Re:Oh, great! by drsmithy · · Score: 1
      If it doesn't have a password, I don't trust it. sudo just helps people to jump walls that they're not supposed to be able to jump.

      That's because sudo is basically just a hack to work around two fundamental unix design flaws:

      1. The concept of an inherently unrestricted user; and

      2. That you need to be root to do a lot of useful things.

      The biggest security problem with sudo is that it doesn't *grant* you $USER's (typically root's) privileges, *it turns you into that user*.

  5. Sudo by Poromenos1 · · Score: 3, Interesting

    What the article mentions is not really a big problem, since that is more or less what would happen if someone guessed the root password (then they could tamper with anything, including the logs). If the administrator isn't knowledgeable, both sudo or root can get hacked, but this doesn't mean that sudo is worse or has more disadvantages than running as root.

    Personally, I prefer sudoing a shell to run as root so I don't have to type the command all the time, but that's just in my home Ubuntu installation which I don't care much about.

    --
    Send email from the afterlife! Write your e-will at Dead Man's Switch.
    1. Re:Sudo by OxygenPenguin · · Score: 2, Informative

      I'm with you there. I often su to root inside a shell and remain there for some time, until I'm finishing executing commands that require root. I don't feel the need to secure my 2 Ubuntu boxes at home enough to only sudo in and out. It's irritating having to type that command over and over again.

      Now, the servers at the workplace are a different story, though I tend to ssh in as root at times as well.

      --
      Read the only personal Runyon page out there.
    2. Re:Sudo by maccallr · · Score: 1
      I never really bothered with sudo until I realised how convenient it was to do
      ./configure
      make
      sudo make install
      when installing things
    3. Re:Sudo by Jason+Hood · · Score: 1

      There is another reason to run sudo over root, and probably the most important. It is significantly easier to track user actions through sudo since commands (can depending on configuration) be associated with the user that ran them. If everyone used "root", the paper trail is much harder to follow. Its also easier to lock down available system commands.

      In my mind the sudo approach is an obvious chouce. But I use both approaches.

      --
      Are you intolerant of intolerant people?
    4. Re:Sudo by Phormion · · Score: 2, Informative

      Well, it's just as convenient to type: ./configure make su -c "make install" At least on Linux, I believe; IIRC, on Solaris you had to give a different argument to 'su', but still, you get the idea.

    5. Re:Sudo by chill · · Score: 2, Informative

      What the article mentions is not really a big problem, since that is more or less what would happen if someone guessed the root password (then they could tamper with anything, including the logs).

      Not quite. The idea is to set it so root can't log in remotely, and that sudo requires the ROOT password and not the USER password.

      This way a hacker would have to obtain BOTH the user password and the root password.

      For even more fun, restrict SSH to not allow keyboard-interactive logins and require anyone who needs to SSH into a box remotely to use a certificate. That way a hacker would need the certificate, the passphrase to unlock it, and the root password. To top it off you can't just "guess" a certificate like you can a password.

        -Charles

      Paranoia -- everyone has to have a hobby

      --
      Learning HOW to think is more important than learning WHAT to think.
    6. Re:Sudo by lp-habu · · Score: 2, Informative
      What the article mentions is not really a big problem, since that is more or less what would happen if someone guessed the root password (then they could tamper with anything, including the logs).
      Not completely true, at least on BSD-ish systems properly configured. If you set the sappnd or schg flags on a file only root can change the file and even root can only append to the file (in the case of the sappnd flag). Since those flags can only be reset in single-user level, that greatly complicates the problem of modifying logs after an intrusion is the sappnd flag is set on them. And yes, these flags do work on OS X although I don't know anyone who uses them routinely.
      $ ls -lo system.log
      -rw-r----- 1 root admin sappnd 1119 Mar 21 14:03 system.log
      Even root cannot modify the existing contents of this file, only append to it, without rebooting into single-user mode.
    7. Re:Sudo by Anonymous Coward · · Score: 0

      Or you can do what I do: rename the containing directory to one starting with a dot, move all the other files back, and recreate that one.

    8. Re:Sudo by lp-habu · · Score: 1

      Ah, for the good old days when systems shipped with 'fsdb'...

    9. Re:Sudo by LinuxHam · · Score: 1
      though I tend to ssh in as root at times as well

      Yikes. One of the first things I usually do after an install is:

      vi /etc/ssh/sshd_config

      PermitRootLogin no

      I once did some work at a university with a guy building servers with public IP addresses. He was leaving root logins enabled. When I convinced him to shut off root logins via ssh, the very next thing he did was:

      visudoers

      hisid ALL=(root) NOPASSWD: ALL
      /me smacks forehead and walks away
      Just as important as good passwords are to ward off dictionary attacks, so are actually having "strong" non-root userids. If I ever see "flarkle" in an ssh dictionary attack, I might fall out of my chair.
      --
      Intelligent Life on Earth
  6. Same applies to Ubuntu by Anonymous Coward · · Score: 1, Informative

    sudo is primed to let you do pretty much anything. And it's far more likely that someone gets my user password that the actual root password.

    1. Re:Same applies to Ubuntu by yo_tuco · · Score: 1

      "And it's far more likely that someone gets my user password that the actual root password."

      That is the big question. However, in a remote attack, a user account name may not be known. The root user account name is (part of the barrier is solved). Cracking a user account password is just as hard as the root unless, of course, you assume a person creating a root account would use a stronger password than a user account.

    2. Re:Same applies to Ubuntu by maxwell+demon · · Score: 1
      If you disallow remote login for root, you are creating a double barrier for outside attackers:
      1. Crack normal user account, to get into the computer
      2. From normal user account, crack root account

      With sudo taking the user password, the second barrier doesn't exist if the first barrier was taken by figuring out the password.

      BTW, you can also give the root account a different name, so the root account name will not be known to the attacker either. As bonus, if you see any attempt to login as "root", you are likely looking at a cracking attempt.
      --
      The Tao of math: The numbers you can count are not the real numbers.
    3. Re:Same applies to Ubuntu by just_forget_it · · Score: 1

      At least we can all agree that it's not like allowing administrative access to any or all user accounts while not requiring a password for anything, or providing any feedback when things get installed in the background, unlike certain operating systems that shall remain nameless.

    4. Re:Same applies to Ubuntu by killerkalamari · · Score: 1

      A non-root alternative is to create a dummy account (with a different password) that is specifically for SSH, then disable logins to every account but it. Then, they still need to su to the real user and guess that password before they can sudo.

    5. Re:Same applies to Ubuntu by Anonymous Coward · · Score: 0

      "create a dummy account (with a different password) that is specifically for SSH"

      Better yet, don't use a password for remote SSH login. Configure SSH to use identity keys that way there is no password to protect.

  7. Sudo is only useful when there are lots of admins by eln · · Score: 5, Insightful

    When there are lots of admins, sudo can be helpful. However, even then it's mostly useless because most admins get so irritated at having to type sudo before every command that they'll just sudo into a shell and be done with it, which sort of eliminates most of the advantages of sudo. To get around this, you'd need a security admin that is not only diligent about what access he gives out, but is also willing to deal with a lot of abuse from the other admins because he won't let them do what they want to do.

    For a single-user system, sudo is pointless. Nearly everyone is just going to sudo into a shell to do anything where root is needed on their own personal box anyway.

  8. Remote managment by solarbob · · Score: 3, Interesting

    As part of my day to day crap sudo can really help in running remote commands as root without having to login as root. We've got a few things setup which check system settings from a central node and being able to use a non root user, and then just using sudo /file really just helps keep things under control. Also with sudo you can fine tune which commands are allowed to be run. Overall a really nice toy

    --
    SolarVPS - Quality Windows and Linux Virtual Servers
  9. This just in: by djh101010 · · Score: 5, Informative

    News flash: Sudo, like many other tools, has a configuration file, which allows you to customize it's behavior. Details will be provided as they become available.

    C'mon, anyone with even a passing involvement with sudo has looked at the sudoers file. You can configure pretty much any group or role based permission you want; if you can describe it as a logical statement, you can do it in sudo. Yes, out of the box, you can sudo to a shell (or to an app which has a shell escape).

    1. Re:This just in: by tvon · · Score: 1

      This is true, however the default configuration will not be changed for most users so it is justifiable to analyze the security "out of the box" as opposed to "with tweaked by an expert".

    2. Re:This just in: by pla · · Score: 2, Informative

      You can configure pretty much any group or role based permission you want;

      With one slight problem... Yes, for a handful of well-known low-complexity programs, you can lock down sudo. For anything more, you may as well just give the user root... For example, if you let your sudo'ers use any shell or editor, or invoke any world-writeable script, game over. Most process-, file-, and account-management programs. Anything that allows explicity suspending to a shell (or invoking an arbitrary subprogram). I could go on.

      As an off-the-cuff generalization, I'd go so far as to say that most programs you need to run as root, you can use to trivially gain "normal" root access to a system. And while you might argue that you generally trust your sudo'ers more than your random users, never forget the old maxim "never attribute to malice that which you can explain as laziness".

    3. Re:This just in: by irc.goatse.cx+troll · · Score: 1

      Not only that, but any general purpose tool(like cp or mv) are just as good as an editor. And if you deny stuff like that, what do you really have left other than maybe a few custom written administrative apps that you could have left suid anyways?

      --
      Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
    4. Re:This just in: by greed · · Score: 1

      On suitable architectures, modern sudo includes a LD_PRELOAD library which it injects to prevent programs from exec()ing other programs. It's still not foolproof, of course, but it makes things like "someuser ALL=(root) NOEXEC:vi" a lot safer.

    5. Re:This just in: by JesseMcDonald · · Score: 1

      I realize you probably didn't check this very closely, but if you put "someuser ALL=(root) NOEXEC:vi" in /etc/sudoers, you might as well just give them full root access:

      [someuser@localhost]$ sudo vi /etc/sudoers
      Password: [....]
      some time later...
      [someuser@localhost]$ sudo -s
      Password: [....]
      [root@localhost]# rm -rf /

      Any program which can be used to write arbitrary data to arbitrary files can be used to escalate priviledges in a similar fashion. A surprising number of program fit this description. Sudo may slow down a casual attacker (Is there such a thing?), but don't depend on it to stop any serious security breaches.

      --
      "The state is that great fiction by which everyone tries to live at the expense of everyone else." - Bastiat
    6. Re:This just in: by Anonymous Coward · · Score: 0

      For example, if you let your sudo'ers use any shell or editor, or invoke any world-writeable script, game over.

      So, you don't let them write to every file on the system. Give them permissions to run 'vim -Z' on a handful of files you anticipate them needing access to. Then they can edit only the files they're allowed to open vim with, and can't open new ones or run shells, etc.

  10. Old news and Poorly written by bombadillo · · Score: 1, Insightful

    This is a poor article. It does not provide any solutions to locking down sudo. Oddly enough it is an article for OS X on a site called linuxboxadmin.com. Why not focus on one of the linux distros that use sudo such as Ubuntu?

    Must be a slow day for news for nerds. More like news for noobs

    1. Re:Old news and Poorly written by gEvil+(beta) · · Score: 2, Funny

      More like news for noobs

      Stuff that flatters?

      --
      This guy's the limit!
    2. Re:Old news and Poorly written by sshutt · · Score: 1

      I admit I'm a noob to ubuntu and generally to linux, but that article pointed out a few things I hadn't bothered to find out yet, like that theres a way to stop needing to type sudo before every command that I need to run as root. Must admit hat the only real benifit I can see to it is that anyone stumbling onto your machine will have a harder time finding an account to log in as if roots not there

      --
      I love the smell of burning karma in the morning...
    3. Re:Old news and Poorly written by Seanasy · · Score: 1
      Stuff that flatters?

      Fluff that splatters?

  11. Good Advice by Se7enLC · · Score: 5, Interesting

    This article is good advice for anyone running a unix-like operating system (OSX, Linux, etc). It's not knocking on OSX, just knocking on the default configuration. Sudo is really just a way to allow root access without allowing root logins. The best way to configure it: Root Account with a unique password (not the same as your user account) Sudo requires password to activate (caching is ok, but no automatic access, no keys) Sudo logs all commands Sudo only enabled for specific user accounts Root account has login disabled, ftp/ssh disabled. (using the /usr/bin/false trick mentioned in the article, I use true myself)

    1. Re:Good Advice by Dom2 · · Score: 2, Insightful
      One of the key benefits of using sudo, particularly in a single user situation is that it uses your regular password, not some "admin" password you typed in at the install 3 months ago and forgot to write down. This is one reason why both OSX and Ubuntu are using sudo.

      Personally, I also like the ability to go back through the logs and see what I've done...

      -Dom

    2. Re:Good Advice by gardyloo · · Score: 1

      Personally, I also like the ability to go back through the logs and see what I've done...

            God. Please tell me that other people also shifted uncomfortably and suppressed giggles when they read that.

  12. Sudo vs. Root? by Evro · · Score: 5, Funny
    --
    rooooar
    1. Re:Sudo vs. Root? by towsonu2003 · · Score: 1
      The requested URL /fight was not found on this server.
      I guess Mr. Barrett stole that one too?
    2. Re:Sudo vs. Root? by maccallr · · Score: 1
      I'll fight you with another hard-to-justify web comparison insecurity of sudo vs. root login ;-)

      You can change "insecure" any other word/phrase (and probably get completely contradictory results).

    3. Re:Sudo vs. Root? by Fhqwhgadss · · Score: 1

      Does it really matter if you're not using the right editor?

      --
      How does a 7-person democracy cut a pie? Into 4 pieces.
    4. Re:Sudo vs. Root? by ObsessiveMathsFreak · · Score: 1
      --
      May the Maths Be with you!
    5. Re:Sudo vs. Root? by iamlucky13 · · Score: 1

      Well, it's better than the message I got:

      Request denied by WatchGuard HTTP proxy.
      Reason: one or more categories denied helper='WebBlocker.2' details='Violence'

      Which won? I have to know. I won't be able to get anything done until I find out.

  13. Sudu or Root? by chad.koehler · · Score: 1

    For usability purposes, sudo is nice because the user only has to enter their own password. However, this can also be detrimental... Users have been socially engineered to just enter their password whenever the box asks for it, and to the "average" user this may mask the fact that they are upping the privileges of the process asking for it... If they had to actually type in (and remember) the actual root password it may be a little more clear.
    All in all, I think it's really a matter of personal preference.

    1. Re:Sudu or Root? by Anonymous Coward · · Score: 0

      For usability purposes, sudo is nice because the user only has to enter [his] own password. However, this can also be detrimental... Users have been socially engineered to just enter their password[s] whenever the box asks for it, and to the "average" user this may mask the fact that [he is] upping the privileges of the process asking for it... If [he] [has] to actually type in (and remember) the actual root password it may be a little more clear.

    2. Re:Sudu or Root? by Anonymous Coward · · Score: 0

      Oh, quiet you. It is perfectly acceptable to use plural pronouns as indefinite singular pronouns and has been for centuries.

  14. How To Become Root on OS X by Synesthesiatic · · Score: 3, Informative

    Last login: Tue Mar 21 10:44:32 on ttyp1
    Welcome to Darwin!
    Hunter:~ Adam$ sudo su
    Password:
    Hunter:/Users/Adam root#

    This is on an unmodified install....woops I guess that root account wasn't disabled after all!

    1. Re:How To Become Root on OS X by grahamlee · · Score: 2, Informative

      Or sudo -s, for that matter. The root account is disabled insofar as it can't log in - although even that's not quite true...

    2. Re:How To Become Root on OS X by beelsebob · · Score: 4, Informative

      The root account is disabled by having the shadow password set to * - thus you can't enter a valid password for root. If you already are root (as in this case) you don't need to enter a password, and thus it allows you to do the command.

    3. Re:How To Become Root on OS X by Leon_Trotsky · · Score: 1
      Exactly. This was pretty much the first thing I did on my fresh install.

      followed quickly by:

      #passwd
      Not very disabled.
      --
      Ohhh! Pay Dirt! A pair of half-eaten choco-pants!
    4. Re:How To Become Root on OS X by Anonymous Coward · · Score: 0

      It's disabled as in it has no password associated with it. If you want to enable it, then you are free to.

      This is better than Ubuntu, which actually patches out code that requires root access (e.g. in the CUPS web admin), meaning you can never fully enable root if you want to.

    5. Re:How To Become Root on OS X by Mwongozi · · Score: 1

      Or alternatively you can just do "sudo -i".

    6. Re:How To Become Root on OS X by cortana · · Score: 1

      The CUPS web admin does not need to run as root in the first place! I believe Ubuntu merely add the message that states that the web admin page is disabled.

      If you want to use it, add the user that CUPS runs as to the shadow group: adduser cupsys shadow. This will allow CUPS to authenticate users against their passwords in /etc/shadow/.

    7. Re:How To Become Root on OS X by ScriptedReplay · · Score: 4, Interesting

      The root account is disabled by having the shadow password set to * - thus you can't enter a valid password for root.

      Why people keep on confusing this?

      Password login to the root account is disabled by having the shadow password set to * - thus you can't enter a valid password for root. Just because password logins are disabled does not mean the account is disabled — try ps -U root -u root u sometime. Besides, 'root' is just one name for uid=0, change your user's uid to 0 and bam! you're it, whatever name you have (but then if you can change your uid you're it already, this was just an academic example)

      Also, if your login relies on other methods than pam_unix then the star in /etc/shadow is meaningless. So in fact it should be further qualified as password login to root relying on /etc/shadow is disabled... The point being that 'root account is disabled' is hugely misleading.

    8. Re:How To Become Root on OS X by Anonymous Coward · · Score: 0

      Does this actually work? The lack of CUPS web admin was enough to make me ditch Ubuntu within a week, so if it is just a matter adding CUPS to the shadow group, then I might give it another try.

      The error page gave me the impression that this functionality was actually removed. The page should really link to information on how to re-enable the web admin.

    9. Re:How To Become Root on OS X by Anonymous Coward · · Score: 0

      As far as I know, it works. I agree that the error message is misleading.

  15. Use sudo to revoke root from a single user by jrifkin · · Score: 5, Insightful
    One advantage of sudo occurs when a box has multiple admins, because a single admin can have his root privilege revoked without affects other admins.

    But when you share a root account, revoking privilege from a single admin means that every remaining admin has to learn a new password.

    1. Re:Use sudo to revoke root from a single user by petermgreen · · Score: 1

      i guess it depends on WHY you are revoking the admins privilages in the first place. if your just moving them to another group with no hard feelings then i suppose you could argue this. If your getting rid of them for misconduct you have to seriously consider that they may have installed a rootkit.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    2. Re:Use sudo to revoke root from a single user by Arandir · · Score: 1

      Does Darwin/OSX use the wheel group? If so, you can lock an admin out of root without having to immediately change the password. RMS considers wheel to be evil incarnate, and thus you don't see this on Linux too much. But it's a damned useful group to have.

      p.s. Of course, with multiple admins, you should be changing the password frequently anyway.

      --
      A Government Is a Body of People, Usually Notably Ungoverned
    3. Re:Use sudo to revoke root from a single user by Anonymous Coward · · Score: 0

      "One advantage of sudo occurs when a box has multiple admins, because a single admin can have his root privilege revoked without affects other admins."

      Never heard of ssh and authorized_keys ?

      Ideally, your root password will be extremely compilicated and locked in a vault.

  16. 2 passwords instead of 1 by Viol8 · · Score: 1

    Ultimately all sudo means is that a cracker has to know
    2 passwords to gain access to root on your system if root
    itself is disabled - a user password and the root password.
    If they cracker has already somehow cracked the root password
    then I doubt they'll have much trouble with a user password
    which are usually far less secure.

    1. Re:2 passwords instead of 1 by djp928 · · Score: 1

      Uh. Not if you have sudo set up the way it normally is. That is, you only need your own password to get root access, via "sudo su" or "sudo -s".

      -- Dave

    2. Re:2 passwords instead of 1 by duffolonious · · Score: 1

      Errr... if you have cracked the root password what the hell do you care about the user password?

      Here's how I "crack" the user password when I have root access.

      # passwd user
      (enter new password)

      I am amused by the simplicity of this game. Bring me your finest meats and cheeses.

    3. Re:2 passwords instead of 1 by Viol8 · · Score: 1

      Yeah , you're right. I was thinking of su. Doh.

    4. Re:2 passwords instead of 1 by asuffield · · Score: 4, Insightful

      Actually, you missed the point of why sudo only asks for the user password. And so did the author of that web page (which is why he's wrong).

      Firstly, asking for a root password has no effect on the security of the system. A cracker does not have to crack an extra password. Once your user account has been cracked, if you know the root password and use su (or sudo or whatever), then at some point you are going to login and do that. Unfortunately, the cracker knows your user password - your .bashrc was replaced, the shell you are running is a trojan. The password that you typed in was captured, and the cracker now knows the root password. In fact, it probably just used that password to launch a rootkit.

      This can be solved, with some form of secured authentication path (like a smartcard device, which can't be trojaned using the user's password, and there are also ways to do this without needing extra hardware). sudo supports stuff like that, if you know what you're doing. But simply asking for a second password, in an application running in the terminal, is no more than a speed bump. It's not the second layer of security that it looks like it should be. Anything you type into the terminal is compromised once an attacker has your user password.

      Secondly, shared passwords are bad security. You can't easily change them - it has to be arranged between several people. You have to pass the secret between at least two people on at least one occasion, and somebody else can overhear when you do that. People tend to be less careful about information that is known to several people. If the secret leaks out, there's no easy way to trace who leaked it. There's all sorts of issues with shared passwords. If you really wanted a second password, you should have one 'root' password for every user who has root access (Kerberos systems allow for this scenario, because a Kerberos environment can have secure authentication paths; sudo and su don't, although you could have one 'login' password and one 'sudo' password by creative use of PAM, but you have to tackle the authentication path issue first).

      Thirdly, the point of sudo asking for the user password is to authenticate that the user currently sitting in front of the computer is the same user that logged in at some point in the past. Users are forgetful; they walk away from their console to get coffee without locking it. sudo attempts to verify that the user currently sitting there is probably the right one, and not somebody else who snuck into their office. If you have sudo ask for a single shared root password, then one of the other users with root access could use somebody else's account, and would appear in the logs as that user. That means they deflect blame for their actions onto somebody else. If you really wanted to have a second password with a shared root password, you should ask for both the user and the root password.

      You could argue that a user with root access can always just clean the logs afterwards - but this is not necessarily true. A system can be configured so that syslog immediately sends every message over the network to another host. sudo deliberately sends the message to syslog before running the command, so that this scenario remains secure. The user could immediately disable this configuration, but they can't stop that first message from going out, saying who they are and when they logged in. (We will assume that this scenario involves ssh access to a server located in a locked datacentre, so there is no opportunity to interfere with the physical network connection).

      sudo's way of doing things really does have security advantages. It may be true that these advantages aren't relevant to the default macosx configuration, but that does not mean they don't exist. However, using a single root password, like the article author suggests, does not have security advantages over the default behaviour (see the first point in this post). And the default behaviour is more convinient for users (who only have to remember one password instead of two), which is almost certainly why Apple set it up that way. The article ignored this aspect.

    5. Re:2 passwords instead of 1 by urbanRealist · · Score: 1
      Let me attack your points in the order you gave them:

      1. Your scenario here is really grasping for straws. Just make sure no users are in the wheel group or its equivalent. Ctrl-Alt-F* if you need to.
      2. This is you most valid point, but introduce an FTP server to the machine and your box is as good as owned by anyone with a packet sniffer if you have sudo enabled.
      3. Remote attacks are FAR more worrisome that someone physically stumbling accross an open terminal that's running as root in the five minutes it takes to get your coffee.

      To conclude, enjoy your sudo! I, on the other hand, will have none of it. Different su* commands for different folk*.

      --
      I've seen a lot of things, but I've never been a witness.
  17. My favorite sudo command: by AsnFkr · · Score: 4, Funny

    sudo passwd root

    1. Re:My favorite sudo command: by mctk · · Score: 1

      sudo -ku

      --
      Paul Grosfield - the quicker picker upper.
    2. Re:My favorite sudo command: by repvik · · Score: 1

      I prefer "sudo su" ;-)

    3. Re:My favorite sudo command: by ThatComputerGuy · · Score: 1

      Why bother with all that? On the few occasions where I've been unlucky enough to have to use a distro that "requires" sudo, I just sudo bash -ls...

      --
      XML is like violence. If it doesn't solve the problem, use more.
  18. Messed up sudoers by Gopal.V · · Score: 3, Funny
    Recently one of my friends editied his sudoers file with the following
    admin ALL=(ALL) ALL
    Now it is obvious to me that he forgot a % in there. From that point onwards, there was no way we could actually run sudo to be able to edit the file using visudo. Since there is no root account, we couldn't just log in as root to fix this issue. And because of the syntax error, sudo refused to work for any user.

    Now, a live CD and a setuid bash executable managed to fix the issue directly, but we learned an important lesson about root-less systems. If you screw up something like the /etc/sudoers, the system is hosed unless you have physical access.

    So as much as I use sudo for almost all my UID 0 needs, I think root still needs to live in every box just to safegaurd against such simple mistakes which ended up costing more hours than the sudo would've saved.
    1. Re:Messed up sudoers by Bake · · Score: 2, Insightful

      I suppose you could write a small wrapper that creates a backup copy of the sudoers file before editing it. That wrapper then creates an at job to rollback the changes after, say 5 minutes, giving you ample time to verify that the new sudoers file works and remove the at job once testing is complete.

    2. Re:Messed up sudoers by petermgreen · · Score: 3, Informative

      oh yeah not having physical access (or a serial console) means you have to be VERY carefull when touching certain parts of the config. This particular example can be avoided by having another way to get root but there are many others such as iptables, sshd etc

      btw you don't need a livecd if you can get to the bootloader prompts, just use init=/bin/bash on the kernel command line and the box will drop straight into a shell. Type exec /sbin/init when you are done to resume normal boot.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    3. Re:Messed up sudoers by Johnny+Mnemonic · · Score: 1

      Single user mode. No boot media required.

      If you've disabled single user mode, there's not much that can be done. That's the nature of security.

      --

      --
      $tar -xvf .sig.tar
    4. Re:Messed up sudoers by PigleT · · Score: 1

      > If you've disabled single user mode, there's not much that can be done. That's the nature of security.

      linux single rw init=/bin/sh

      Next? :)

      You might also like to keep an alternative such as _super_ installed, against this eventuality.

      --
      ~Tim
      --
      .|` Clouds cross the black moonlight,
      Rushing on down to the circle of the turn
    5. Re:Messed up sudoers by stevey · · Score: 1

      Notice the comment at the top of the sudoers file?

      "# This file MUST be edited with the 'visudo' command as root."

      If you read and follow that advice you'll find you get a warning if you create a bogus file, and you wouldn't get into problems...

    6. Re:Messed up sudoers by Englabenny · · Score: 1

      1. He should have used visudo
      2. On OS X, press cmd-S at boot and you enter single user mode. Mout fs writable, edit file, reboot.

    7. Re:Messed up sudoers by Anonymous Coward · · Score: 0

      Notice the comment at the top of the sudoers file?

      "# This file MUST be edited with the 'visudo' command as root."

      If you read and follow that advice you'll find you get a warning if you create a bogus file, and you wouldn't get into problems...

      Except that his file had the correct syntax, it just changed admin from group privileges to privileges for a user named admin, which visudo won't catch.
    8. Re:Messed up sudoers by petermgreen · · Score: 1

      no need for the single option as you aren't about to run init anyway.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    9. Re:Messed up sudoers by cloudmaster · · Score: 4, Insightful

      In addition to the other comments about using visudo (which respects the EDITOR env. variable, so if you really wanna use pico or whatever, just run "EDITOR=pico visudo"), you should always leave an active shell runnuing when you're editing something that could potentially break login access. Editing the main authentication scheme in pam.d/? Editing sudoers? Changing nsswitch.conf around? Make sure that you already have a root shell open in another terminal - either another xterm, a virtual console, or something else. Save your changes, make sure they worked, and if not, you can usually use the already-open root shell to change it back.

      Yes, this is the voice of experience with breaking just about everything at some point or another - it's how you learn. Well, it's one way *I* learn, anyway. :)

    10. Re:Messed up sudoers by teslar · · Score: 3, Insightful

      Yes, you could indeed do this.

      And in other news, opticians around the globe are surprised to find that hindsight is always 20/20.

      :)

    11. Re:Messed up sudoers by hab136 · · Score: 1
      Now, a live CD and a setuid bash executable managed to fix the issue directly, but we learned an important lesson about root-less systems. If you screw up something like the /etc/sudoers, the system is hosed unless you have physical access.
      So as much as I use sudo for almost all my UID 0 needs, I think root still needs to live in every box just to safegaurd against such simple mistakes which ended up costing more hours than the sudo would've saved.

      If you blow up /etc/passwd or /etc/shadow, you're still going to need single user mode/boot disk whether you use sudo or a root account.

      There's lots of ways to blow up the system. The fact that sudo has one more file that you can bone yourself with - one that you shouldn't be editing very often (use groups, not individual users) - isn't really a good reason to enable a root account.

    12. Re:Messed up sudoers by Enrico+Pulatzo · · Score: 1

      If it was FreeBSD or OS X, you could have tried single-user mode. I assume most Linux distros have an option for that as well, but I could be wrong. Once in single-user mode, you can mount the file system as normal and edit the config file.

    13. Re:Messed up sudoers by HTMLSpinnr · · Score: 1

      The point of visudo is two-fold. One is syntax check, the other is to ensure proper permissions are used on the file. If joe blow edits an external file and copies it in w/ the wrong perms, Sudo is going to bitch and you get nowhere. Of course, the smarter admin/hacker would set the correct perms on /etc/sudo first.

      --
      $ man woman *
      -bash: /usr/bin/man: Argument list too long
    14. Re:Messed up sudoers by x2A · · Score: 1

      "opticians around the globe are surprised to find that hindsight is always 20/20"

      ...if only they'd figured that out to begin with

      --
      The revolution will not be televised... but it will have a page on Wikipedia
    15. Re:Messed up sudoers by jdhutchins · · Score: 1

      That's one of the reaons you don't just edit sudo- you use something like 'visudo' to edit it, which does syntax checks after you're finished. If you made a mistake, you have a chance to fix it before it locks you out.

    16. Re:Messed up sudoers by ernst_mulder · · Score: 1

      This is just one example.

      Other faults might not be easily cured even when you do have a root account, a "sudo chmod 000 /bin" by accident wrecked an old unix system I once worked on, I never made _that_ mistake again...

      On the Mac, with physical access of course, most things like these are easily fixed by putting the Mac in Target Disk Mode (start up pressing the T) and attaching it as a disk to any other Mac with full access to all files on the disk regardless of their privileges. Physical access is required tough.

    17. Re:Messed up sudoers by spitzak · · Score: 1

      If root screwed up /etc/passwd (or any of dozens of other files such as the init.rc stuff) and then logged out, you would be just as hosed. I really don't see how sudo is worse.

  19. The best way to secure the root account... by aurb · · Score: 5, Funny

    ...is to choose a really difficult password and forget it. This will secure the box from its' worst enemy - yourself.

    1. Re:The best way to secure the root account... by Yosho · · Score: 1

      Er... that's really no different from just disabling the root account, except for the fact that a potential cracker could use a brute force attack to guess the password.

      --
      Karma: Terrifying (mostly affected by atrocities you've committed)
    2. Re:The best way to secure the root account... by aurb · · Score: 1

      Yes, but with this technique and with no sudo, there's no way of reenabling the root account. So it's safer.

    3. Re:The best way to secure the root account... by Arimus · · Score: 1

      Er... go out and look for a sense of humour ;)

      --
      --- Users are like bacteria -> Each one causing a thousand tiny crises until the host finally gives up and dies.
    4. Re:The best way to secure the root account... by MBAFK · · Score: 1

      That would be why I am now running john to break a password:

      guesses: 0 time: 13:23:10:57 c/s: 4993 trying: cwtdi50d

      1337 passwords 1, Mat's brain 0

    5. Re:The best way to secure the root account... by Matilda+the+Hun · · Score: 1

      He can't, he left it in his /root folder and forgot the password.

      --
      Tluin natha Linux xxizzuss uriu olt bwael mon'tun.
    6. Re:The best way to secure the root account... by x2A · · Score: 1

      my forgotten bios password beats your forgotten root password any day!

      --
      The revolution will not be televised... but it will have a page on Wikipedia
    7. Re:The best way to secure the root account... by CCFreak2K · · Score: 1

      Despite the fact that it was probably intended to be funny...after the things I've done, I'd vouch for this.

      --
      "Beware of he who would deny you access to information, for in his heart he dreams himself your master."
  20. Problem with both sudo and Root by Lussarn · · Score: 3, Insightful

    When your normal user has his mind set on performing a specific task (Such as installing the newest spyware-ridden p2p-downloader) you can popup a big red button and naming it "explode", the user will press it if he thinks it will get him closer to performing the task. Putting up a dialog and ask for the root password is for normal users only an obstacle to get by. They don't know what it mean, but they know how to get by it (By inserting the password).

    Don't know any way of solving this except for training though. Or possibly making it IMPOSSIBLE to do certain tasks. But that no good solution.

    1. Re:Problem with both sudo and Root by chris_eineke · · Score: 1
      Don't know any way of solving this except for training though.
      I don't think that's the right answer. A reckless driver doesn't become less reckless by visiting driver education. She knows that she is reckless, maybe even proud of it, and she'd be damned if she had to change her ways.
      --
      "All you have to do is be fragile and grateful. So stay the underdog." Chuck Palahniuk, Choke
    2. Re:Problem with both sudo and Root by vertinox · · Score: 1

      When your normal user has his mind set on performing a specific task (Such as installing the newest spyware-ridden p2p-downloader) you can popup a big red button and naming it "explode", the user will press it if he thinks it will get him closer to performing the task. Putting up a dialog and ask for the root password is for normal users only an obstacle to get by.

      Hrm... I didn't know windows had root accounts. Unless you mean Administrator, but from my understanding most people don't have to worry about typing their password in to install that spyware. All you to do is make sure ActiveX is running (which is should be by default) and then point your IE to the appropriate or non-related website and *bam* all that software is install right away no hassle for you :)

      Who needs fancy buttons and second guessing admin passwords that the end user may or may not have.

      --
      "I am the king of the Romans, and am superior to rules of grammar!"
      -Sigismund, Holy Roman Emperor (1368-1437)
    3. Re:Problem with both sudo and Root by arminw · · Score: 1

      ....Or possibly making it IMPOSSIBLE to do certain tasks. But that no good solution......

      On OSX there is no need to use the admin password by a standard user or even the terminal. On new Macs we name the first account "boss" or "master" and set the system up so it is the only account that can run the terminal program. All the others get their user name and a standard account. As an admin I never use the boss account for anything other than doing real admin task, using terminal if needed. Other utilities are also disabled for standard users. For ordinary everyday use, standard users can do everything they need to do. The "Timbuktu" program allows remote administration only over the local network, because the firewall blocks most external access. Certain users are assigned a fixed IP which is allowed to bypass firewall and browsing restrictions programmed in the router.

      --
      All theory is gray
  21. No it's not a mystery by doomy · · Score: 4, Insightful
    Every other command after starting a root shell does NOT get logged at all. All you can tell from this is when someone started the root shell. Whatever happened after that is a mystery.


    All that is in bash history for the root user. And anyone who knows how to clean that can clean the log as well.
    --
    ...free your source and the rest would follow...
    1. Re:No it's not a mystery by Anonymous Coward · · Score: 0

      ...so you use chflags to lock down the shell log and then you CAN'T delete it :-)

      Simple.

    2. Re:No it's not a mystery by 99BottlesOfBeerInMyF · · Score: 2, Informative

      All that is in bash history for the root user. And anyone who knows how to clean that can clean the log as well.

      Actually, this is not always true. In some environments remote logs are kept and versioned. Root on a workstation would not have access to wipe the remote log, only add more entries to it. Still, anyone working in such an environment would almost certainly have made other changes to the workstation anyway, so arguing over the default setting is pointless.

    3. Re:No it's not a mystery by cortana · · Score: 1

      Can't the attacker use chflags to remove the append-only flag? :)

    4. Re:No it's not a mystery by Anonymous Coward · · Score: 0

      we are still talking about default OS X installs right? lawl

    5. Re:No it's not a mystery by Anonymous Coward · · Score: 1, Informative

      No. See, securelevel 1 or higher.

    6. Re:No it's not a mystery by Anonymous Coward · · Score: 0

      Wrong. The user just does unset HISTFILE problem solved. And I don't know about FreeBSD, but in linux. Unless the kernel is doing execution logging. Is there a kernel extension for that in FreeBSD?

  22. SUDO is flawed by Anonymous Coward · · Score: 0

    The principal idea of Sudo is flawed! It works with ~ 10 user accounts, but if you have, say 30 - 100 accounts then you are likely to have misconfigurations, because it becomes a tedious job to maintain the access configuration file. I've seen this happen many times - unauthorized users accessing files they should have no right to access.

    1. Re:SUDO is flawed by Homestar+Breadmaker · · Score: 1

      Yeah, I guess maybe people with severe brain damage shouldn't be configuring sudo.

  23. This says it all. by Anonymous Coward · · Score: 1, Funny
    1. Re:This says it all. by x2A · · Score: 1

      Actually I do, and as I always have done, my brain's thought processes are fully centered around that fact, and doesn't make stupid mistakes. People do argue with me about it, but the fact is, I'm good enough to not need that safety net. If someone's not, then by all means, keep the safety net there. I don't have time for it.

      --
      The revolution will not be televised... but it will have a page on Wikipedia
    2. Re:This says it all. by smoker2 · · Score: 1
      Yeah, like really good drivers don't need seat belts, or really good sailors don't need lifeboats/life preservers.

      I am the only user on my box at home, and I still use a seperate root account. It prevents me from deleting my own files for one thing. If I really need to keep something safe, I chown it root:root and its safe from me, my scripts, and any other interference. I can still read the files, but I can't modify them, and that's useful. There have been a few times when I've emptied the wastebasket in gnome, and seen things fly past that I didn't put in there (intentionally). No more (I hope).

  24. root == lazyness by LinuxRulz · · Score: 1

    Everyone will agree that the less you use your root account, the less vulnerable your system is. People are lazy. If they can su and do everything as root, they tend to do so. However if you "block" the root account and force the user to use sudo and type in their pass each time, they tend do use less root, thus increasing the security.

  25. sudo hmmm by towsonu2003 · · Score: 1

    sudo -> Ubuntu -> ??

    1. Re:sudo hmmm by Anonymous Coward · · Score: 0

      Profit?

  26. Classic!!! by Anonymous Coward · · Score: 0

    nohup cd /; rm -rf * > /dev/null 2>&1 &

    Ctrl+D
    LOL!!!

    1. Re:Classic!!! by x2A · · Score: 1

      first of all you're nohupping the 'cd /' command, not the intended rm -rf... so really you'd want nohup rm -rf /*

      secondly (hehe, sorry), the first Ctrl+D (at least in the setup I have) warns of background jobs, although a second Ctrl+D will log out. Alternatively you can openvt the command.

      --
      The revolution will not be televised... but it will have a page on Wikipedia
  27. config config config by devlp0 · · Score: 1

    sudo is the most secure way of allowing certain users root privileges to all or some system commands WHEN CONFIGURED PROPERLY. "man sudoers" shows you can do a lot with sudo and restrict users/groups as much as you want. Since coming across sudo, I have disabled root accounts on all boxes I have used. It rocks.

    --
    >/dev/null 2>&1
    1. Re:config config config by sn0wcrsh · · Score: 1

      um... like sudo tcsh... rock on.

  28. Security Schmecurity. by Anonymous Coward · · Score: 0

    Just expect script with ssh to root shell and script away.
    Nobody expects hardtyped root passwd in user scripts.

    1. Re:Security Schmecurity. by maxwell+demon · · Score: 1

      Well, if you want to avoid anyone cracking the root password, the most secure way is to have root log in without a password. After all, if there is no password, no one can crack it! :-)

      --
      The Tao of math: The numbers you can count are not the real numbers.
  29. ubuntu by LadyNik0n · · Score: 1

    Ubuntu also does this as well.

    1. Re:ubuntu by Anonymous Coward · · Score: 0

      This post brought to you by a grant from the Department of Redundancy Department.

    2. Re:Ubuntu by Anonymous Coward · · Score: 0

      "I wonder how Ubuntu devs and users feel about this."

      I like when Howto's use sudo in their instructions because it makes it clear when you need to be root and when you don't. I've experienced some Howto's that didn't make that point clear or forgot to tell the would-be reader when to switch back to user... oops.

    3. Re:Ubuntu by drew · · Score: 1

      When I installed Ubuntu it was a minor annoyance and nothing more. The first time I tried to do something as root, I discovered I first had to do "sudo passwd root" and everything worked fine after that.

      --
      If I don't put anything here, will anyone recognize me anymore?
    4. Re:Ubuntu by towsonu2003 · · Score: 1

      Please see https://wiki.ubuntu.com/RootSudo for sudo use in Ubuntu. Enabling root password (as you did) is not recommended for Ubuntu...

    5. Re:Ubuntu by drew · · Score: 1

      I've read it before, and while I agree that their reasoning makes sense as the default behavior, I prefer to have an active root account. They recommend against unlocking the root account because they prefer the sudo model and they believe that the advantages outweigh the disadvantages. For me they do not, and I prefer to have a real root account. There is nothing unique to Ubuntu that makes having an unlocked root account less desirable than any other distro.

      --
      If I don't put anything here, will anyone recognize me anymore?
  30. Re:Sudo is only useful when there are lots of admi by Abalamahalamatandra · · Score: 2, Interesting

    I would disagree, in some cases. I like that Ubuntu does things this way, because it's designed for less-experienced users. I often see posts in the forums that list several commands in a row to execute, all preceded by sudo.

    Being a more experienced admin, that looks wierd and counterproductive. But here's the nice thing: it keeps users from opening up a root shell and then forgetting they're in that shell, where they could easily wreak havoc. I think that's a good thing.

    Me, I pretty much just always type "sudo -i" to do my stuff. But I wouldn't want less experienced users doing that.

  31. Sudo more secure? by smoor · · Score: 2, Insightful

    I'm just a part time sysadmin, so I don't know the nitty gritty, but it was beat into my head to use sudo instead of root simply so that I wouldn't "forget" I was in root and do something stupid...

    There is no reason (usually) to be logged in as root, and that anything I need to do as root I could do using sudo. It seems to me that you hack with sudo just as easily as with root...

    1. Re:Sudo more secure? by SCHecklerX · · Score: 1

      I use sudo on the branch office linux-based firewalls I deploy for use with an 'admin' account. That account is the one my NOC can log into, via keyed ssh (each users's keys are added to the admin accounts authorized_keys file). Sudo is configured to only allow specific commands, and to require no password. So I get strong authentication, and a NOC that can troubleshoot things without having to escalate to me and waste my time for what 99.999% of the time is an ISP connection issue.

  32. Re:Sudo is only useful ..... by Aspirator · · Score: 0

    On my own boxes I commonly use sudo for installing software,
    I do all of the compilation etc. in a user account.

    If I log in as root then I have the hassles of all of the
    files I create being owned by root unnecesarily,
    and then I have to change them all back.

    sudo also allows me to get a similar effect to suid, but on
    a more restricted basis, via sudoers.

    So I dispute your assertion about sudo ONLY being useful
    when there are a lot of admins.

  33. Ubuntu by towsonu2003 · · Score: 3, Interesting

    I guess most of the things in that article applies to Ubuntu (root disabled, sudo-only access to root privileges) as well. I wonder how Ubuntu devs and users feel about this.

  34. Re:Sudo is only useful when there are lots of admi by sinfree · · Score: 0, Offtopic

    I find sudoku to be the most useful... wow, I've really got to stop playing that game.

  35. Sudo is a tool not the entire solution by johnjaydk · · Score: 1
    Sudo provides a number of features:

    1. Issue commands as root whith the sudo prefix (and some password checking)
    2. Logging of commands issued using sudo.
    3. Handout of semi-root permisions to assistant operators (PFY's ?)

    The first one is all about convinience. It makes it easy to be logged in as regular user and issue root commands as needed. This lessens the incentive to be logged in as root al the time and thereby can reduce the risk of accidentially issue unfortunate commands as root.

    The second is a help to figure out what went wrong in case you need to un-fsck the system after an accident.

    The part about handing out semi root to PFY's is really the least interesting part about sudo. Either you trust people or you don't.

    I agree that sudo becomes a hassle when you need to perform surgery but for daily tasks it's really great. If you need to be root all the time then there is something really wrong with your setup.

    --
    TCAP-Abort
    1. Re:Sudo is a tool not the entire solution by Hieronymus+Howard · · Score: 4, Informative

      4. Allowing non-human users (e.g. www) to execute a strictly limited set of commands as root.

      For example, I have this command in my sudoers file:

      www ALL = NOPASSWD: /sbin/ipfw add 2000 deny ip from [0-9.]* to any in

      This allows apache to use /sbin/ipfw to add the ip addresses of script kiddies to the firewall. Note that only adding addresses to one particular rule (in this case rule 2000) is allowed - any other usage of ipfw will fail.

    2. Re:Sudo is a tool not the entire solution by Anonymous Coward · · Score: 0

      The part about handing out semi root to PFY's is really the least interesting part about sudo. Either you trust people or you don't.

      That seems an ignorant statement and ignores the principle of least privilege. Give people only what is required for them to efficiently do their job.

      I have gone so far as to mandate that sudo access should never be configured for command shells and anything that might yield a command shell. The point of sudo is to allow a user to run a set of commands as root - not to hand over the keys to the kingdom.

    3. Re:Sudo is a tool not the entire solution by chivo243 · · Score: 1

      Social Engineering and Manipulation: Don't let your ego run as root! http://www.theregister.co.uk/2006/02/24/bofh_2006_ episode_8/

      --
      Sig Hansen?
    4. Re:Sudo is a tool not the entire solution by SCHecklerX · · Score: 1

      Or even real human ones. I do this so that my NOC can troubleshoot and admin remote firewalls: Cmnd_Alias FREESWAN=/usr/local/sbin/ipsec,/sbin/service,/sbin /shutdown,/usr/sbin/mtr,/sbin/mii-tool,/bin/rpm admin ALL = NOPASSWD: FREESWAN

    5. Re:Sudo is a tool not the entire solution by scribblej · · Score: 1

      That was honestly completely illuminating. I've been running ubuntu for ages now and usually the first thing I do is sudo passwd root and forgetaboutit.

      Now I'm excited to look into some of the much, much cooler possibilities. Thank you. I don't have any mod points, and you're already +5 informative. Posts like this should go to six.

  36. I found it informative. by Thaidog · · Score: 1

    My box has ssh enabled, but it is only my box and I have not granted anyone access to it. My admin account has access via ssh but ssh is configured not to allow root logins. Also, the root account is disabled for the large majority of the time.

    Even though I feel that this should be sufficent it troubles me that the sudo feature is enabled as the article implies by default. I think it makes much more sense that you need the root password for su and sudo access. I think that possibly adds another layer of security to the system.

    --

    ||| I still can't believe Parkay's not butter.

    1. Re:I found it informative. by Anonymous Coward · · Score: 0

      I hat guys speaking about their "box" :-)

  37. Didn't we already have the wheel group for this by SpaghettiPattern · · Score: 3, Informative

    Didn't we already have the wheel group for this? No direct root login and only members of wheel can su to root. http://en.wikibooks.org/wiki/Guide_to_Unix/Explana tions/Becoming_Root

    --

    I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
    1. Re:Didn't we already have the wheel group for this by 6*7 · · Score: 2, Informative

      Short answer: no

      Long answer: man sudo and man sudoers

      medium length answer: sudo gives a much more fine grained access control. If I had known about sudo I never would have needed to write wrapper programs with setuid permissions and all kind of groupbased access control to them myself.

  38. That's an Interesting Pickle by Greyfox · · Score: 1
    If Apple made an administrative account in sudoers and a non-admin one without it, most users would probably just run as the administrative account anyway. Sudo's reasonable, but most people will blindly enter their password when prompted for it. It took me years to get my room mate conditioned to ask me whenever the computer asks her something she doesn't understand. To be really secure, you should usually run as a user that has no way to write to system directories. Apple (or maybe BSD) does a really good job of keeping admin tasks separate and still doing things like setting up the network and stuff like that. Most of the time there's no reason why a user would ever need admin access.

    If you make the effort to go beyond Apple's default security you'll reduce your potential exposure to any malware that might ever be written for the platform.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  39. Re:Sudo is only useful when there are lots of admi by Joshua+Cowan · · Score: 4, Informative
    most admins get so irritated at having to type sudo before every command that they'll just sudo into a shell and be done with it
    The BOFH patch for Bash works well for this scenario.
    For a single-user system, sudo is pointless.
    It is an effective way to eliminate root logins and encourage least privilege practices.
  40. The Monad shell won't be in Vista by ccmay · · Score: 1
    Word has it that Vista will change that and there will be sudo like capabilities but I suspect it is too soon to tell if it will materialize and if so, in what form.

    Not in Vista, it won't.

    Back when Vista was still Longhorn, they were planning to include a new Microsoft Shell, aka MSH, aka Monad. But they are saying now that it won't be released with Vista.

    -ccm

    --
    Too much Law; not enough Order.
    1. Re:The Monad shell won't be in Vista by B3ryllium · · Score: 1

      Monad has absolutely nothing to do with sudo-like behaviour; what the GP means is that Windows will prompt for an admin password in limited accounts before allowing changes. Kind of like what Mandriva/KDE do in their GUI admin tools.

    2. Re:The Monad shell won't be in Vista by ccmay · · Score: 1
      OK, I see, a GUI sudo. OS X has this too, of course.

      One of the things I hate most about Windows is having to run a piece of ordinary software from an administrator account to make it work properly. Although to be fair, this is msotly the fault of lazy or stupid software makers.

      -ccm

      --
      Too much Law; not enough Order.
    3. Re:The Monad shell won't be in Vista by Anonymous Coward · · Score: 0

      From what ive tested of Vista is that it does not need a password to run things with admin rights. you just right click the exe and "run with admin rights".

    4. Re:The Monad shell won't be in Vista by CCFreak2K · · Score: 1

      In the past, Windows was centered around one user, which meant the user was root. This was always the case until Windows NT came along. Unfortunately, it means most legacy software will run incorrectly (if at all) under Restricted User. Hell, even the Windows 2000 userpasswords control panel tells you that users in the Users group can use the computer, but may have problems using legacy software (which I assume means software designed for Windows NT will run correctly with normal user credentials).

      --
      "Beware of he who would deny you access to information, for in his heart he dreams himself your master."
  41. Re:Sudo is only useful when there are lots of admi by Flwyd · · Score: 4, Informative

    I'm the only user on my Linux laptop. My password is dead simple; I'm not worried about security -- the most likely people who might try to do something to my computer are other developers in my company, and they probably have a good reason.

    However, I never run sudo su Why? Being forced to type "sudo" in front of potentially dangerous commands forces me to think a second time and make sure I'm not doing something stupid. If I type rm -r * and get prompted that I don't have access, you bet I'm going to double check to see if I'm in the right directory.

    --
    Ceci n'est pas une signature.
  42. Re:Sudo is only useful when there are lots of admi by goodchef · · Score: 3, Informative

    Read the sudo manpage. After you authenticate for the first sudo command, subsequent invocations won't require a password for a set interval of time (default is 5 minutes, unless overridden in /etc/sudoers).

    --

    "Inflammable means flammable? What a strange country!" -Dr. Nick, The Simpsons

  43. Re:Sudo is only useful when there are lots of admi by MaoTse · · Score: 2, Interesting

    That's right.

    What many linux affectionados do not realize is there are many much more advanced power user control systems then sudo. My favorite example is RBAC which has, unlike sudo, some corporate/security professional appeal. See there. It is mostly used on Solaris where the integration level is impressive. For example we can make a requirement that some operations can be only performed by two admins (a "two men rule" ).

    Sure, sudo can also can be taken to a much higher level when properly configured, but still ;-)

  44. Here's the Score by 99BottlesOfBeerInMyF · · Score: 4, Interesting

    By default OS X machines use the same password for sudo commands as they do for the regular user account. If you are more concerned about security than the average bear (or OS X user) you can change the password or you can disable sudo altogether and enable the root account with a different password. All of this is good info for those interested in security, but who are still learning.

    From this article I predict a number of people knocking this default setup and then a rehash of the old argument as to what the default should be. I contend, that it is probably the correct default. OS X is a workstation not a server. It is designed for normal users. Having two password (heck having even one) is a usability issue for many users. People are confused by the whole concept of passwords and many have trouble remembering even one. Further, setting a second password only slightly increases the difficulty for a competent cracker. The truth is, there will be local escalations for the foreseeable future. OS X is not a super-locked-down server.

    Basically, for the average user, a second password gains them very little except confusion. For more advanced users, well they can change the defaults, as many do. Maybe the only issue here is the in-between people. Those are the people targeted by this article. Those that might want to change the defaults if they knew about the issue and how to do it. Maybe this configuration should be made a little easier, or even incorporated as an option in the install process.

    This default bears revisiting should Apple ever move to a more locked-down system. Maybe when users are accustomed application specific privileges they should also be introduced to a more layered security scheme. For now, though, I think the usability issue outweighs the security one.

    1. Re:Here's the Score by d0ktorbuzz0 · · Score: 1

      Agreed, the default Mac OS X account setup is aimed at a person who wants to get online, load their iPod with music, play with some photos, dash off a quick memo in Word, etc. And since Apple markets machines that are easy and intuitive, especially for regular folks and computer neophytes, this is understandable. Since the underlying system tools and configuration mechanisms are *nix-like, a security-conscious administrator or user can harden their system much the same way any other *nix admin would do. There are some interesting differences between OS X and other *nixen; it is vital to know and understand these differences. I like the book Mac OS X Security, by Bruce Potter, Preston Norvell and Brian Wotring. Published in 2003 it is a bit out of date w/r/t/ Tiger, but the majority of the material is still current and will remain so for years. In fact much of the information is also useful to other *nix systems. It covers issues from system installation to application security (often overlooked by users and by other security how-tos) to network security to after-the-fact forensics. All together it is a very good treatment on security for Mac OS X and I use it often as I set up or tweak my Macs. I don't work for the publisher or any of the authors, but I use the book pretty regularly as a resource.

    2. Re:Here's the Score by Anonymous Coward · · Score: 0

      > Having two password (heck having even one) is a usability issue for
      > many users. People are confused by the whole concept of passwords and
      > many have trouble remembering even one.

      It's the security admins that are confused about this issue, not the users. Remembering one, two or 2 dozen passwords is neither confusing nor troubling to anyone that managed to pick up the basic skill of recognizing letters, forming meaningful words and ordering them in (possibly less meaningful but syntactically correct) phrases. Basically, if you treat users as dumb cows they're not going to make you any wiser by telling you that indeed they _are_ capable of the incredible feat of remembering some randomly ordered characters from a pre-determined set of about 100 give or take a dozen. Your users aren't stupid, they are lazy, and fooling you like you are the stupid cow.

      Hell my 80 year old grandma can remember all the phone-numbers (landline and mobile) of her 5 surviving sisters and over a dozen grandchildren - and I don't think I have to tell you grandchildren tend to change mobile phone-numbers like slashdot readers don't tend to change their underwear.

      It's you that are confused about the mental capabilities of your users, the users themselves know pretty darn well how it works, they just don't feel like it because, hey, we hired a security guy for that sort of stuff, right?

    3. Re:Here's the Score by 99BottlesOfBeerInMyF · · Score: 1

      Your users aren't stupid, they are lazy, and fooling you like you are the stupid cow.

      Maybe you aren't understanding the concept of "usability." I doesn't matter if they are lazy or stupid. Forcing your users to remember or keep track of multiple passwords is work for them. This means it decreases the usability. Inconveniencing users for whatever reason needs to be justified by some real benefit to them. Since adding a second password provides no significant advantage to the average user, I don't think it is a good idea to do. OS X needs the common opinion that it is harder to use than Windows like a hole in the head.

      Obviously this is not to say that users should not be forced to use a second password in certain locked down environments where security is more critical, but in that case you won't be using the default settings for the machine anyway.

  45. Personal Feeling by matth · · Score: 1

    I don't like SUDO. If someone has figured out my account password, and gotten through all other layers of protection.. I want them to have to figure out the root password.. not just sudo and enter my password again.

    Same reason I don't allow root login through SSH and why I firewall the SSH ports on my machines.

  46. better way by r00t · · Score: 1

    Keep an xterm open with a root shell.

    It'd be nice if this had a distinctive window border. It's possible with fvwm I think.

    Better yet, duplicate the GNOME (or KDE) menu as a white-on-red version labled "root", with all the games and crap greyed out. That's pretty much sudo for a GUI. (per-command stuff in the regular menu is lame, because some commands are useful both as root and as non-root)

    1. Re:better way by lar3ry · · Score: 1

      Use iTerm on OS X (freeware), and set it up so that you have a session called "local root." The session can be "sudo bash -login" to get a login shell (pasword required) with root privilege. The session should also have a distinct color (black foreground, yellow background works) so you know you're using a priviledged session.

      Then... only use this session for those times when you really need to run a series of commands with root priviledge. Don't keep this session open, or you'll be tempted to use it all the time. After you finish typing your commands, exit the session.

      Use "sudo" for one-time escalation commands in your normal shell.

      --
      "May I have ten thousand marbles, please?"
    2. Re:better way by maxwell+demon · · Score: 1
      It'd be nice if this had a distinctive window border. It's possible with fvwm I think.

      An alternative would be to change the background.

      On an xterm, you can use e.g. the bash command echo -e '\e]11;pink\a' to set the background color of the window to pink. Indeed, you could add the escape sequence to the root command prompt, and another switching back to your normal background color to the normal user command prompt. That way the background color will change automatically if you do su (however it will not if you run a command with sudo, except if that command is a bash).

      This escape sequence doesn't seem to work on the gnome terminal, however, and screen also eats the control sequence (although IIRC there are ways to pass a control sequence unaltered through screen).
      --
      The Tao of math: The numbers you can count are not the real numbers.
    3. Re:better way by mr.scoot · · Score: 1

      You can do this with Terminal in OS X, too.

      1. Setup a window with the colors and fonts you want. (red on black, maybe?)
      2. File ->Save As
      3. Set the "Execute this command" field to your choice of sudo incantations.
      Click Save.

  47. sudo -s by oglueck · · Score: 1

    I never used "sudo -s" but always "sudo bash" on systems that allowed it. Because prefixing all commands with sudo was annoying...

  48. Quick Solution to sudo abuse by maynard · · Score: 1

    Just use your handy editor, emacs, vi, Microsoft Word - whatever - to remove that pesky user "root" and its "UID 0" from /etc/passwd then update the netinfo database. Reboot Mac. Problem solved!

    1. Re:Quick Solution to sudo abuse by Anonymous Coward · · Score: 0

      Don't use Microsoft Word to edit config files, defaulty you will knacker them.

      Posted as AC ascouldn't be bothered remembering my password!

    2. Re:Quick Solution to sudo abuse by Anonymous Coward · · Score: 0

      /etc/passwd.doc

      ~shudder~

  49. Painful. by lady*seven · · Score: 1
    This article truly was less-informed than I thought it would be. There's some sysadmin principle based on this logic though; if access is available in any way, it's a security hole. sudo is perhaps the most secure of the holes, though; it provides a control over access that you can't have with the wheel group or giving out the root password. also, I'm fond of the following:
    scarlet@glimmer:/home$ sudo cd shel
    Password:
    sudo: cd: command not found
    --
    -- lady*seven --
  50. Requiring root password? Isnt that bad? by TekGoNos · · Score: 1

    Then, you can force sudo to require the root password

    Hu? I though one of the strength of sudo (over su) was that you DONT have to give out the root password to every user that needs some administration powers.

    Of course, if the root account is completly disabled and the root password is ONLY used to authentificate against sudo, it's slightly less of an issue, but even then I dont think it's better than requiring the user password.

    Example :
    admin Alice has all powers (can sudo a shell)
    admin Bob can only edit httpd.conf and restart apache

    Alice forgets to close his session (but did close all root-shells) and Bob walks by his machine. He types in sudo in a terminal. If sudo asks for Alice's password, Bob has to guess it. If however, sudo asks for the root password, Bob knows it and can gain a root shell.

    OTOH, it forces an external attacker to guess/acquire 2 different passwords, but this can be solved differently. If Bob tends to choose weak passwords, this can be solved by rejecting weak passwords (for admin users) right away. And if admin B gives out his password to whoever asks ... well, if he knows the root-password, he will gives that out too, so it's an attacker that can acquire 1 password from Bob will be able to get a second one too.

    Bottom line : Requiring a root password for sudo seams like a stupid idea.

    --
    I have discovered a truly remarkable proof for my post which this sig is too small to contain.
  51. Re:Sudo is only useful when there are lots of admi by eln · · Score: 1

    Yes, I know that. But admins are inherently lazy, and even typing "sudo" before every command is a burden that most don't like to deal with.

  52. Old, but valid news by dnamaners · · Score: 2, Insightful

    This "problem" has been around a while and is not really a Mac OS X thing problem. In short poorly configured systems are less secure, imagine that. I can make my self type 3 or 4 different passwords to get to sudo or root, will this make me more secure, perhaps. However I guarantee that if Apple did this the first thing every user would do is enable root, or otherwise make it more sane and easy to administer the system. If by some greater decree they made it impossible to do this, fewer people will want such system, as it will make them harder to use. Whatever you do, if you have boot, you have "root" ( or at lease root like access). In short it is possible to layer on many levels of security over the "root" access of a system but it this actually wise?

    I don't use much OS X but I do use Linux quite abit. When I set up my machines, of course I use root access, lazy heck no. I have hordes of little tweaks and such to perform, packages to install, things to edit and permissions to set. If I had to use sudo, my first command would be to open a root bash shell. As for security, a new system it not accessible to the outside, thats it. After a system is up and running, I tighten things up.

    First thing, as mentioned, is to disable root access by ssh. Of course, use public keys instead of passwords where possible. However why not go a simple step further, and the article missed that. Most of my accounts, and certainly all those accessible with ssh don't even need the privileges to use sudo or su to root at all. In fact in most cases my externally accessible shell accounts have a very limited set of commands they can run, simply because shell access is so insecure to begin with (hello gcc under remote shell users). I feel that this is clean and efficient and not a real pain to setup.

    If you are paranoid and want a 2nd password for "root" access, use such a limited user for all users, then make a second account that may use sudo or root and log the heck out of it. Make each prospective admin su to that first. in the end, its only how much security is reasonable that wins. if you need more unplug the box and lock the thing up in a closet to prevent physical access by lock key, this too can be broken...

    When a pack of wolves hunt a herd of sheep, as a sheep you need not out run the wolves to be safe, only the slower sheep. These slower sheep (aka windows) are generally quite abit slower these days than you (OS X). However, this all depends on the number of wolves you keep (or allow) on your netoworks... If you can't generally trust your users you have other problems.

    1. Re:Old, but valid news by swordgeek · · Score: 1

      You made one good point and several arguable ones. However, the good point is the entire basis of the whole silly article, so please allow me to repeat it:

      poorly configured systems are less secure.

      That's it! Yet another article telling us that poorly configured systems are less secure. Amazing stuff.

      --

      "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
  53. What's the point? by Anonymous Coward · · Score: 0

    I really don't see how sudo makes things any more secure. It's really just a shared root account.

    People tell me that it protects from viruses if you log in as a normal user and only sudo when you need to install software, but surely a virus is capable of modifying your PATH to run a custom binary when you type 'sudo', capturing your password, and gaining privileges that way?

    People tell me that you can only give root access for particular commands, but anybody with an ounce of intelligence can use that to gain privileges. sudo make install? Nope, you can just write a Makefile to create a root shell. sudo apt-get? Just create a package that has a root shell in it. And so on.

    All the advantages for security that sudo is touted to have seem like they are completely illusory to me. Where's the real advantage to using sudo?

    1. Re:What's the point? by 6*7 · · Score: 1

      "Where's the real advantage to using sudo?"

      You just mentioned them. But as your examples point out, good things can be used in a bad way.

      I you would really be interested in using sudo to your advantage you would read 'man sudoers' or some of the examples already given here.

    2. Re:What's the point? by Anonymous Coward · · Score: 0

      You missed my point. sudo is often touted as a way to grant limited privileges. That's the primary benefit over using a root account. But sudo's limits aren't limited at all, making it indistinguishable from simply using a root account. That's not an advantage, that's a false sense of security.

    3. Re:What's the point? by soloha · · Score: 1

      sudi IS a way to grant limited root privlieges. Nobody says you have to put: user ALL=(ALL) ALL in sudoers. You can be extremely precise in granting privileges with entries like: %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom %users localhost=/sbin/shutdown -h now If for no other reason, sudo is (somewhat) useful in guarding against automated brute force login attacks - rather than an attacker repeatedly guessing agains a known username (root), they have to guess against unknown user names. Good passords help, but how long/complex can they reasonably be in practice - any any password can be guessed with enough time.

  54. Alternate methods by Spazmania · · Score: 3, Informative

    I ran in to these kinds of issues back in the Solaris 2.2 days and came up with a different solution.

    Solaris' problems were even more acute. Sudo was a download; it didn't come with the system. If you changed root's shell from the minimal Bourne shell the boot scripts would malfunction. More, root's home directory was "/". So setting up a personalized environment where you could use root access effectively was a pain.

    The solution I came up with was a second root account. I just added another name with uid 0 using a seperate password, a seperate home directory and the ksh shell. Then I randomized the main root password, stored it away and promptly forgot it. I'd only need it for fsck on boot.

    Later when I was in charge of multiple system administrators I gave each one their own root account. This let them set up their environment in a way that worked for them, it showed me who was using root commands when and it logged their commands to individual .bash_historys so I could see who screwed up.

    It also means that like with sudo when a sysadmin leaves I don't have to change all the passwords. I just delete their account.

    I still use sudo for folks who I don't expect to do much as root, but the sysadmins get their own root account.

    --
    Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
    1. Re:Alternate methods by quantum+bit · · Score: 1

      First thing I do on a root login:

      rm -f .bash_history && ln -s /dev/null .bash_history

    2. Re:Alternate methods by jeremyp · · Score: 1
      The solution I came up with was a second root account. I just added another name with uid 0 using a seperate password, a seperate home directory and the ksh shell. Then I randomized the main root password, stored it away and promptly forgot it. I'd only need it for fsck on boot.
      I thought that was a standard trick on Solaris systems. A sysadmin friend of mine told me to always do it rather than change root's shell to anything more friendly than sh because sh is the only shell you can guarantee to be installed on the root partition. Apparently it gets embarrassing in single user mode if the shell is not on a mounted partition.
      --
      All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
    3. Re:Alternate methods by Cow+Jones · · Score: 1
      First thing I do on a root login:
      rm -f .bash_history && ln -s /dev/null .bash_history

      I can only guess at your reasons for that; my root sessions (on a remote server) usually begin with 'last', 'procinfo', 'ps axuf', 'top' and the like. If you don't want bash to log your current session, just do this:
      HISTFILE=

      --

      Ah, arrogance and stupidity, all in the same package. How efficient of you. -- Londo Mollari
    4. Re:Alternate methods by Spazmania · · Score: 1

      Which would make it pretty easy for me to figure out which of my sysadmins screwed up the server, wouldn't it? (Hint: You.)

      --
      Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
    5. Re:Alternate methods by Spazmania · · Score: 1

      I shoulda gotten a patent. Then I could sue all those independent inventors. :P

      --
      Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
    6. Re:Alternate methods by bender647 · · Score: 1
  55. Pretty Tenuous Argument by jinxidoru · · Score: 4, Insightful

    As far as I can figure, his argument all comes down to someone possibly stealing or guessing your password. Doesn't this problem exist with root as well? I love that his solution is to disable sudo and enable remote login on root. He then says that you should only allow public key authentication. So now we are back to the original problem. If someone obtains the password to an authorized account, they now have non-password root access to any server they want. From there, it's not too hard to setup another public key on the root servers that links to an unprivileged account. Now the user cannot just change their password every week for security, they need to go update all of these keychains. No, I'm afraid this author is horribly wrong. If you want to get rid of the problem of using your own password for doing root work, shut down sudo and use su. Do not under any circumstance enable remote login on root.

    In related news, I am so tired of all of these non-news blog entries that keep being put on Slashdot. Give me real news from a reliable source, not some no-name idiot that has no clue what he is talking about. Seriously, we need some sort of blog tag that allows us to immediately identify blog articles and appropriately ignore them.

    1. Re:Pretty Tenuous Argument by maccallr · · Score: 1
      I am so tired of all of these non-news blog entries...

      I'm with you there.

  56. Phil Collins by Jon+Luckey · · Score: 5, Funny
    Phil Collins probably had fits when this didn't work:

    pcollins$ su su sudio

    --
    -- 3 events that reshaped the world in the 20th century: WW1, WW2, and WWW
    1. Re:Phil Collins by Anonymous Coward · · Score: 0

      Phil Collins next tried to set up a marketing deal with Sony:

      PS1=pcollin$$$

      But some commands don't work like they did back in the '80's.

  57. Re:Sudo is only useful when there are lots of admi by yo_tuco · · Score: 1

    "For a single-user system, sudo is pointless."

    You have that backwards. On a single user box, it makes the most sense to use sudo. On the other hand, having multiple user accounts on a box and administrated by another person then a root account makes sense.

    As others have said. You can type

          $ sudo -i


    which is really no more a effort than typing

          $ su

  58. TONS more info on main sudo page by xmas2003 · · Score: 1
    Go check out the main sudo page which has tons more info. Also consider making a donation to Todd so he can continue work on this long-time incredibly useful Unix Tool. Or consider helping out with code - my feeble contribution some misc. sudo-tools.

    I'm surprised this article made the front page of /. as it arguably confuses the issue more IMHO.

    --
    Hulk SMASH Celiac Disease
  59. Re:Sudo is only useful when there are lots of admi by Wdomburg · · Score: 1, Insightful

    None of the admins here has any problem using sudo. And if someone was caught circumventing security policy, they'd be fired. Period.

  60. Re:Oh, great! (ways around) by HTMLSpinnr · · Score: 4, Insightful
    Ya know, I've always worked around the first two with exclusions, and the -s flag is automagically included.

    Try the following:
    Cmnd_Alias SHUTDOWN = /sbin/shutdown
    Cmnd_Alias HALT = /sbin/halt
    Cmnd_Alias SHELLS = /bin/sh, /bin/bash, /sbin/nologin, /bin/ash, /bin/bsh /bin/ksh, /usr/bin/ksh, /usr/bin/pdksh, /bin/tcsh, /bin/csh, /bin/zsh
    Cmnd_Alias SU = /usr/bin/su, /bin/su, /usr/sbin/visudo
     
    %usergroup ALL=(ALL) ALL,!SHELLS,!SU,!SHUTDOWN,!HALT
    However, that's not going to stop joe user from copying bash over to /usr/local/bin/myshell and still gaining root that way. A better approach is to permit specifics and allow for an implicit deny rather than explicitly permitting all and denying specifics. There are times though when it's a giant PITA to permit just about everything specific under the sun because there's always going to be one command you've left out here or there. At that point, you just have to trust your users enough to know better and then take steps to secure the machine from the outside world.
    --
    $ man woman *
    -bash: /usr/bin/man: Argument list too long
  61. Re:Sudo is only useful when there are lots of admi by Jim_Maryland · · Score: 1

    Typical use here is: sudo su -

    Now what might be interesting is to see how Solaris's RBAC comes along. I'm still sort of new to it myself, but the little that I've done with it has allowed me to create a role that can manage a few services related to a single project (they are limited to start/stop on a temporary basis and refresh as needed). In my case, I setup that role as having manage and modify rights in SMF. The users don't need to have root or sudo, just a role login which doesn't have a lot of permissions.

    In my development environment, sudo is often prefered (pre-RBAC and current as most of the SA's supporting us aren't exceptionally UNIX savy) over giving out the root password as the root password may be common to multiple systems and a user may only need to be in the sudoers file for a particular system.

  62. RBAC by Anonymous Coward · · Score: 0

    And this is why I like RBAC much better. Next to all your issues with security when it comes to the config file you also face the simple fact that you're dealing with a setuid program here which can form a potential problem on its own. And the chicken/egg principle (allowing someone to edit a certain config file might also give them access to editing /etc/passwd / /etc/shadow).

    An alternative to this is the way Solaris does it... Namely by using RBAC which allows me to grant access to a specific part of the system without having to worry about other parts. Another decent overview here tells you some more, while Sun itself also has some good stories, to be found here while a good overview can be found here.

    What Solaris might lack in userfriendly-ness (when looking at distributions like Ubuntu, SuSE and OS X) it sure makes up for robustness and simple quality. In my opinion the days of sudo are (or should) be numbered.

  63. untrue by x2A · · Score: 1

    you can create multiple logins that resolve to UID 0; there doesn't have to be just one 'root' account, passwords don't have to be shared.

    --
    The revolution will not be televised... but it will have a page on Wikipedia
    1. Re:untrue by pclminion · · Score: 2, Insightful
      I've done that, and it's a serious pain. I'm also not convinced that it won't fuck various things up. For one thing, there is now a many-to-one mapping from usernames to UIDs. The mapping is supposed to be bijective, and a lot of system software probably depends on it. Is your "true username" the associated name from /etc/passwd (in which case all the users would be called "root" presumably because it's first in the list), or does it derive from the $USER environment variable (in which case the user could alter the username as he pleases)?

      And consider the zillions of applications which use your username. Do they get it from /etc/passwd (which would be wrong) or do they get it from $USER (which could also be maliciously set wrong)? Having multiple users sharing a UID is an administrative disaster.

    2. Re:untrue by Spudnuts · · Score: 1

      It's interesting that you mention this, because my FreeBSD passwd file came with the following stock entries:

      root:*:0:0:Charlie &:/root:/bin/csh
      toor:*:0:0:Bourne-again Superuser:/root:

      but yet it doesn't seem to be a problem.

    3. Re:untrue by x2A · · Score: 1

      I've never seen it be a problem at all. Usernames resolve to a UserID, which is what the underlying system calls use. Somewhat like having multiple domain names pointing to a single IP address.

      We're not talking here about having different root accounts, we're talking about having multiple logins for the root account. A reverse lookup on the UID 0 will return 'root', no matter which user/pass you logged in as.

      This way, different people can have a different user/pass combo to access the root account. It's no more complicated than that.

      --
      The revolution will not be televised... but it will have a page on Wikipedia
  64. Sudo insecure if same account used for email by adrenaline_junky · · Score: 4, Insightful

    The most insecure thing about sudo that I see occurring frequently is that a person with an account that has sudo access uses the SAME account for unencrypted email.

    So basically their password gets sent openly when they login via POP to check their email. Anyone with a sniffer can get their password, login, and have full sudo access.

    Now that's great security for ya.

    That's why when I install a distro like Ubuntu that defaults to using sudo I always make the first account a dedicated admin account. Which sort of raises the question of why not just use "root" in the first place...

    1. Re:Sudo insecure if same account used for email by drew · · Score: 1

      sure, if they are dumb enough to use the same password for email as they do for their account...

      --
      If I don't put anything here, will anyone recognize me anymore?
    2. Re:Sudo insecure if same account used for email by adrenaline_junky · · Score: 2, Interesting

      sure, if they are dumb enough to use the same password for email as they do for their account...

      Right... which happens to be the default behavior of every linux distro I've ever worked with.

  65. I, Root by Doc+Ruby · · Score: 1

    Why shouldn't a single user of a host login as root, or just have root privileges for their named account? Switching contexts with su/sudo makes it more likely to make mistakes.

    --

    --
    make install -not war

    1. Re:I, Root by Aranth+Brainfire · · Score: 3, Informative

      Same reason you're not supposed to log into Windows as an administrator all the time; if something goes wrong (security hole in a user-run program), or if you accidentally use the wrong command, your system isn't totally screwed (hopefully).

      Windows actually has a similar feature, sort of- right-click on something and choose "run as...", then log in as an administrator.

      --
      "Quoting yourself is stupid." -Me
    2. Re:I, Root by Proteus · · Score: 1
      >Why shouldn't a single user of a host login as root, or just have root privileges for their named account? Switching contexts with su/sudo makes it more likely to make mistakes.

      Maybe that's true for you, but if so it's the exception and not the rule. I have my OSX desktop set up in the same way as my Linux desktop: there's a user I log in as for normal use, and a user I use for admin. The latter is allowed to sudo and do whatever it wishes.

      The idea works like this:
      1. When I'm the "normal" user, I can't accidentally make administrative changes; more importantly, any software I run that tries (innocently or otherwise) will fail.
      2. When I'm the administrative user, I can do "safe" administrative tasks without becoming root (i.e. I have rights to restart services, establish new file shares, etc.). But, more dangerous behavior (like installing a new binary in OSX's /Applications directory) requires root privileges.


      The second is the key. It gives me an opportunity to think a second time about my choice (did I really want to overwrite Eclipse?); more importantly, it means that I'm less likely to be caught unawares if an application does something "risky" that I didn't expect.

      A real world example on my Mac. The backup software I used required access to a directory where it kept tabs on what was backed up last time -- the files there were allowed to be modified by the admin user. Worked great. Then I upgraded the backup tool, and the next time I backed up I was prompted for my password to authorize root access. This caused me to cancel my operation and discover that on first run, the backup tool wanted to install a network service, which I definitely didn't want. I denied the access and switched vendors.

      I would never have known it happened unless I'd had sudo as a gatekeeper.
      --
      We may not imagine how our lives could be more frustrating and complex—but Congress can. – Cullen Hightower
  66. Re:Sudo is only useful when there are lots of admi by Tim+C · · Score: 1

    because most admins get so irritated at having to type sudo before every command that they'll just sudo into a shell and be done with it

    So configure sudo to prevent them from doing so.

  67. How to disable root by SuperKendall · · Score: 1, Funny

    I reccomend you run a find command the deletes all files owned by root. That should do the trick! Without files, how could they be enabled?

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:How to disable root by Kadin2048 · · Score: 1

      I have developed a new security tool, which I guarantee will make any Linux box Perfectly Secure. All you need to do other than running it, is to type your password at the prompt; it will scan your system and remove all vunerabilities.

      #! /bin/bash
      sudo rm -rf /

      --
      "Ladies and gentlemen, my killbot features Lotus Notes and a machine gun. It is the finest available."
  68. Simple Solution by BodhiCat · · Score: 1

    Simple Solution: Don't turn on Remote Login (SSH) on your OS X Mac. In fact keep all Sharing under Sharing in System Preferences tuned off. Now if I can just convince my cow-irkers that they don't need these things everything would be fine. "Oh, I have to access my computer from home." "Well then just turn on File Sharing." "But, its over the web, don't I need Web Sharing and Remote Login turned on?" Undsoweiter.

  69. Bah by elmegil · · Score: 1

    Last time I checked, on MacOS X anyway, it was trivial to do sudo /bin/sh and voila I have a root shell. Get over it.

    --
    7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
  70. Re:Sudo is only useful when there are lots of admi by tony.damato · · Score: 2, Informative

    Social engineering can assist. I work in an administrative environment where not only is sudo the preferred way to do things, but we have a policy where using 'sudo su' or 'sudo sh' can cause one to be written up and possibly terminated. I know, it sounds strict, but it works for us and makes usage of sudo much easier to manage.

    There is an example in the 'sudoers' manual which tells how to remove 'su' and shell commands from those which sudo allows. I had to implement this after we discovered that some individuals who needed sudo access to do some things were using 'sudo sh' to get around the restrictions we placed on them. After the initial threat, they were much more agreeable to how we wanted them to do things *grin*

  71. Re:Sudo is only useful when there are lots of admi by UttBuggly · · Score: 1

    If you restrict allowable commands under sudo, it becomes pretty useful. When you add a shell logger that requires you to identify yourself and the reason for opening a shell, you have an audit trail.

    In short, sudo can be very good, but it requires some work and the ability to withstand much cursing from the recently crippled. :o)

    --
    I am my own gestalt.
  72. Sudo is more useful when there are lots of admins by Yobgod+Ababua · · Score: 1

    Very true, never opening root shells also helps minimize opportunities for you to break something horribly by typing a command in the wrong window. It's a good policy and the 'ease of use' loss is, to be honest, pretty minimal, especially compared to the security gain.

    Where we do need to use actual root windows, I try to make sure they are visually distinct with color scemes that scream "DANGER, THINK!"

  73. Re:Sudo is only useful when there are lots of admi by squatex · · Score: 1

    Same here....and I cant even begin to count how many times its saved my ass.

  74. So, sudo uses PAM, right? by hey! · · Score: 1

    And Apple makes it's own hardware. Hmm. sounds like an opportunity to me.

    So what if Apple built a hardware access token into their keyboards? When you get a new keyboard, you plug it in, hit a special "administrator" button, and type your password on the computer, which effectively pairs the computer to the keyboard. The event is logged to eneraseable flash ram on the mobo.

    After that, you can configure your computer to allow sudo (a) any time the keyboard is connected, you are logged in, and have typed something in the minute or so , or (b) any time the user taps the "administrator" button or (c) every time the user taps the "administrator" button and provides the admin password, which is plain old two factor security.

    You could tap the adminsitrator button ten times and it would allow the next ten sudo'd commands; a second "admin off" button has a blinking light meaning the keyboard is about to autorize something; tapping the "off" key sets the number of commands to authorize to zero. An LED on the "admin off" button blinks. Holding "admin off" button down for two seconds means that the keyboard won't allow any sudo commands until the password is entered.

    A system like this requires that you have complete control over the hardware and the software. Only Apple does.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  75. Perhaps Slashdot is being Trolled By AdSense by HighOrbit · · Score: 1

    A few weeks back, Slashdot ran a story from Wall Stree Journal about an "original content" scam that takes advantage of Google. Basically, writers are paid to pump out senseless "original content" articles (sometimes rehashing other sources, sometime outright nonsense). This is because apparantly, Google will drive down your page rank if you don't have "original content". So you see all these "blogs" and "news sites" that have crappy, useless, or wrong content,.... but plastered all over the pages are Google AdSense adverts.

    Now, apparantly they just submit the pages directly to slashdot, and they get swallowed hook, line, and sinker. Perhaps the slashdot editors should look for a pattern. Do certain submitters only submit stories that are plastered with AdSense? Multiple submitters at the same IP? Not that an advertising supported site is wrong per se, but come on....

  76. I swear to God by Anonymous Coward · · Score: 0

    After these comments run their course, all you geeks will have your licenses taken away for overuse of the word "sudo". Bad geeks, bad!

  77. Obviously... by Warlock7 · · Score: 1
    This means that if someone guesses your password or steals it (and has access to it locally or via SSH), they can take over your box just as if you had root enabled.
    [SARCASM]Well, I certainly didn't think that if someone guesses my password that my account might be at risk.[/SARCASM]

    Thanks for that truly groundbreaking observation. I never would've guessed that might be a problem.
  78. Re:Sudo is only useful when there are lots of admi by Etyenne · · Score: 1

    Admins at your place are too lazy to type "sudo" ? I bet they are too lazy to document their work too, and to test their changes.

    --
    :wq
  79. Re:Sudo is only useful when there are lots of admi by Fulcrum+of+Evil · · Score: 1

    So configure sudo to prevent them from doing so.

    Can't do that - they're admins. A better approach would be to educate them about logbash.

    --
    "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
  80. MUCH MUCH Much better solution by goombah99 · · Score: 1

    Virtually all the tom foolery suggested inthe article is unneeded since on macs there is a better solution. Have two logins. One has admin privs and one does not. use the latter for your bussness.

    While this can be terrifically painful on Linux and Windows its not painful at all on a mac. What happend is that nearly anytime you do an opertaion that requires root privledges from the gui the mac does it but first pops up an authentication box that wasks not for your everyday account password but instead your admin user password. So it's nearly seamless.

    For the few cases where this wont suffice, you can either fadt user switch to admin, or you can pull up a terminal and su to the admin.

    this has all the same protections the sill approach advocated in that article suggests.

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:MUCH MUCH Much better solution by TheCarp · · Score: 5, Insightful

      I would argue that this is even not needed.

      Just pick a good damned password.

      Seriously. Nobody really cracks passwords anymore. Sure there are the ubiquitous SSH scans on the net looking for just insanely stupid passwords. Pick a good password and move on.

      Firstly... any security discussion that starts with "what if they have your password" is flawed. They shouldn't have your password, if you let it go, or its THAT easy to guess.... then your security is broken right from the start and there is nothing you can do YOU ARE FUCKED.

      I worked at a place that did sudo for root passwords, and I thought it was one of the god damned stupidest things ever. The ONLY benefit of it, was that it forced us to figure out how to make secure passwords for root that people could easily memorize and taught us all to use mnemonics. That was seriously the ONLY benefit.

      Basically if you log in locally, or use ssh for everything, then your password never goes out in clear text. If you worry about ssh, then fine... use key authentication, then your password never gets used for anything but sudo.

      Basically.... this is a totally fake issue. If someone has your user account password, you are just screwed. They can trojan your entire environment such that the chances that you will EVER notice is minimal, and then they will just get the root password the very next time you sudo.

      Bottom line... protect your password... your security depends on it.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    2. Re:MUCH MUCH Much better solution by ScuzzMonkey · · Score: 3, Interesting

      This may be true for an individual user who doesn't have a lot to protect, but it's hopelessly naive in a business or other multi-user situation, or anywhere that security needs to be taken seriously. If you don't play games like "what if they have your password" and institute suitable measures to mitigate those potential situations, you're not even remotely secure. Things get accidently executed under the wrong account, keyloggers exist, people look over your shoulder... there are any number of ways the simply having a good password isn't really good enough. Redundancy and layering is the ONLY way to get trustworthy levels of security.

      --
      No relation to Happy Monkey
    3. Re:MUCH MUCH Much better solution by TheCarp · · Score: 1

      Yet you don't answer my assertion that sudo or really anything that grants access based on the root password, is exactly as secure as the least secure account that it is used from.

      The fact is that this privilege escalation is so trivial with just a little work, that there is very little protection against it.

      Maybe next we need all our home dirs and login scripts owned by root too... that way our login environments can't be trojaned.

      ugh. I am all for layers of security, this is why I highly recomend NOT using your user password for logins at all except for locally.... and using your user password basically as your personal root password.

      as for keyloggers, they are amusingly agnostic. They will happily catch both your user and root passwords seprately and equally... same is true for people looking over your shoulder.

      As for things getting executed in the wrong account, not sure how thats relevant or can be solved except by stopping making any mistakes at all. I will let you know if I ever figure out how to completly stop making mistakes.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    4. Re:MUCH MUCH Much better solution by goombah99 · · Score: 1

      If you are an admin user I can get root access without knowing your password. the mac security framework is not secure. I'm not going to tell you how as it's an unpublicized existing security hole that requires a large policy change and wont likely happen for some time. But it exists. You do NOT want to work as admin all the time. you want to selectively activate admin as needed and require it to ask you a different than normal password when you do.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    5. Re:MUCH MUCH Much better solution by Kadin2048 · · Score: 3, Interesting

      This is the second time I've heard vague references to "unpublished security holes" in Mac OS X, but every claim I've heard has been seriously short on content. Has it been reported to Apple? (You know they have an email address and a PGP key for this sort of thing.) If not, why not? Submit it, give them six months or whatever, and beyond that I don't think you're doing anyone any favors by keeping it secret; the chances are you're not the only person who knows about it and somebody is going to be selling it to blackhats on Russian IRC channels soon enough. Seems a lot better that everyone know about the hole and at least get a chance at fixing it (or at least to lock down their systems) -- or at least make it public and give Apple a serious kick in the ass when the bad PR starts rolling in.

      I'm sorry if I sound like I'm attacking you, but this is not the first time I've heard someone talking about some "secret hole/backdoor/vunerability" and I'm getting sick of the contentless assertions. If you're hiding it because you want to sell it on the black market, that's one thing, but if that's not the motivation, just don't think you're really doing anyone a favor by sitting on it.

      --
      "Ladies and gentlemen, my killbot features Lotus Notes and a machine gun. It is the finest available."
    6. Re:MUCH MUCH Much better solution by TheCarp · · Score: 1

      Thats a seprate issue entirely.

      I agree with the other poster, having vague assertions is unfortunate, I can only hope its vague because of a genuine desire to keep a theoretical hole under wraps until it can be fixed.

      On the other hand it could be an attempt to spread FUD abotu MacOS.

      However, I will note that my experience is with Unix systems in general, and usually not ones that a person logs into locally. (even if I am typing this on such a system now... my laptop)

      Frankly, if your system is as broken as you say, then forget sudo, your fucked to begin with. Get that fixed, then look at sudo.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    7. Re:MUCH MUCH Much better solution by ernst_mulder · · Score: 1

      One problem is that most people I know use the SAME password for their systems as their POP e-mail and in fact most other things. So, the password protecting their systems (never going over a line unencrypted by means of ssh) might go over a line or even through the air because they also use the same password for other things, like telnetting, ftp-ing, checking mail using insecure connections, remote control applications, on-line registrations (!) and whatsnot.

      I even have seen people using the same login/password for PayPal for the services they pay to....

      Please use multiple passwords people...

    8. Re:MUCH MUCH Much better solution by Anonymous Coward · · Score: 0

      I also have access to anus of god...

      "I'm not going to tell you how as it's an unpublicized existing security hole that requires a large policy change and wont likely happen for some time. But it exists."

      you talk, I hear "blaa, blaa, blaa, I am so damn '1eet I sip hot lead and shit rivets."

      mod parent down for being such a loser.

    9. Re:MUCH MUCH Much better solution by Anonymous Coward · · Score: 0
      Yet you don't answer my assertion that sudo or really anything that grants access based on the root password, is exactly as secure as the least secure account that it is used from.
      Yet he did quite effectively point out that your "any security discussion that starts with "what if they have your password" is flawed" statement is bullshit and hence you pretty clearly don't know what you are talking about.
    10. Re:MUCH MUCH Much better solution by TheCarp · · Score: 1

      Its good to know that you can answer two completly different assertions by just stating that the first one is wrong. Or even that a person who "obviously doesn't know what they are talking about" must thus be wrong.

      Thanks for the info

      Good talk, see ya out there.

      --
      "I opened my eyes, and everything went dark again"
    11. Re:MUCH MUCH Much better solution by TheCarp · · Score: 1

      Yup. Agreed.

      People shouldn't do that either.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    12. Re:MUCH MUCH Much better solution by Arandir · · Score: 3, Funny

      Our IT department (of a 70,000 person organization) audited my lab, and discovered that I had used an "insecure" password password. They determined this because they were able to crack it... ...but it took them 18 hours to crack, and they had to do it within the lab because the system in question was behind two firewalls, and the system itself had no sensitive information on it. It was an internal development system, and the password was made easy (two English words separated by a symbol) so that our sixty developers could remember it. The password itself was written on the whiteboard in the lab, but the auditors didn't mention that.

      --
      A Government Is a Body of People, Usually Notably Ungoverned
    13. Re:MUCH MUCH Much better solution by noamsml · · Score: 1

      Uh, that's what most linuxers do, and it's pretty damn convenient to switch users, too. You just write su in the shell, put in your password and you've got admin privs! Amazing, isn't it? You know what's even more amazing, that that existed way before OSX was even born!

      Also, isn't it terrific that when I want to select an administration app from the GNOME menu, it does exactly as you described?

    14. Re:MUCH MUCH Much better solution by TheCarp · · Score: 2, Insightful

      Ahahahaha thats pretty funny.

      As I said before, nobody except security auditors really crack passwords anymore.

      That said, its really not that hard to come up with a pretty acceptable and memorable password.

      I like to take a song lyric or other phrase of about 8 words. Then take either the first letter of each word to start. For some words, I will choose a symbol other than the first letter, like "and" could become & or + ... and pretty much any other random substitution I can think of.

      Then I pick out words to capitalise, or replace with l33tspeak numbers etc.

      by the time I am done, I have a fairly nasty looking string that maps easily in one direction back to a phrase. Write it down, say the phrase while you use the password.

      By about the 5th time, I can burn the paper copy.

      For example, I will make one up right now....
      password - mnemonic

      4eIwMo^n - for example I will make one up now

      I once, and I only admit this because I know that every system that has used this password has since had it changed several times.... I once used lyrics from "the song that does not end".... sadly it wasn't in use long enough to break the brains of anyone else in the office.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    15. Re:MUCH MUCH Much better solution by Anonymous Coward · · Score: 0

      You have obviously never used sudo. The whole point of sudo is that you don't need the root password to do something as root. It makes every sudoers password important. If they already have the your passwd, they have your sudo passwd. The fact that you are modded so high means that no one else has a clue either. And yes - people still crack passwords. You are witless.

    16. Re:MUCH MUCH Much better solution by TheCarp · · Score: 1

      and you obviously have not read the article or used sudo where it was setup specifically to NOT do that and ONLY take root passwords.

      Read the docs again man, its either a config or compile time option. I honestly forget because, well, I hate the feature and wont use it.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    17. Re:MUCH MUCH Much better solution by Syberghost · · Score: 1

      For anybody whose sudoers file is one line, sudo is probably overkill.

      For anybody whose sudoers file is 352 lines, like the ones in the smaller implementations at the Fortune 500 company I work for, the "everybody that needs root has the password" approach is asinine, and a great way to make sure you flunk your SOX 404 audit.

      There's also the question of employees who need root access for a single task. Using UNIX groups and setuid/setgid binaries doesn't give you the kind of logging that sudo can, which is important for SOX 404 compliance as well.

      However, for the small implementations, there is a still an argument for sudo or other similar programs, which is:

      Teaching people to do it right the first time benefits them far more if they ever HAVE to do it right than teaching them to do it wrong the first time.

    18. Re:MUCH MUCH Much better solution by 44BSD · · Score: 1

      Typically, with sudo access is granted based on the requester's password, not the root password.

      This is extremely useful in an environment where:

      1. Direct root login is limited to the console.

      2. The root user has an extremely complex password which is changed only when
            a "firecall" situation prompts its use.

      3. Multiple system administrators need to elevate their privs, and need to have
            a half-decent audit trail.

      The fact that this kind of environment is something many people haven't experienced doesn't detract one iota from sudo's utility. It was written for such an environment, and it does a damn good job.

    19. Re:MUCH MUCH Much better solution by jZnat · · Score: 1

      Dude, you pretty much described what sudo does...

      I don't know how, but I'm sure you can change your sudo password to something else.

      --
      'Yes, firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
    20. Re:MUCH MUCH Much better solution by TheNinjaroach · · Score: 1

      What happens when a user tries to keep their many, many passwords the same? Not all systems store and transmit your password in the most secure manner - so it can be likely that someone gets ahold of your account password through other means. Keeping the root password seperate from my user account is important if I'm going to use my account password on other systems that I don't believe use the best security practices.

      --
      I went to eat some animal crackers and the box said, "Do not eat if seal is broken." I opened the box and sure enough..
    21. Re:MUCH MUCH Much better solution by ScuzzMonkey · · Score: 1

      I don't really care about that assertion; it's entirely correct. The one I take issue with is stating that all you need is a good password and everything will come up roses. You do need a good password; you may also need sudo, and you need other mechanisms in place in case those fail, and that's the point, not that sudo is somehow the end-all, be-all of secure systems.

      --
      No relation to Happy Monkey
    22. Re:MUCH MUCH Much better solution by goombah99 · · Score: 1

      I submitted it a few months ago. Gave them a tar file that runs the exploit. Wrote it myself. It works. It's not a programming bug that's creating a security hole but an flaw in the authentication policy design that grants persistent authentication across sessions. But I'm not saying any more.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    23. Re:MUCH MUCH Much better solution by TheCarp · · Score: 1

      I never meant to imply otherwise.

      I am very specifically talking about the case at hand. That is to say, contrasting normal sudo use with configuring sudo to take the root password only.

      Essentially, this turns sudo back into su or su -p or some such depending on your system and how you want it to treat your environment.

      Its easy to imagine all manner of attack scenarios, but you have to direct your attention where it will do the most real good.

      Frankly I think the tradoffs of sudo vs su fall far on the side of sudo. However, this setup from the article, throws away most of the benefit of sudo, in the name of "security".

      it seems silly to do for a machine used mostly locally. Its a nightmare in a production environment.

      I have always liked the model of admins use SSH RSA keys, then use their own password for sudo. That way their system access password never leaves the local box, until they need to become root.

      Then you generate really good random root passwords, and put them in a place where they are safe and can be pulled out in a dire emergency to be used.... then immediatly changed.

      I have never actually worked in those conditions, but we did consider it at some meetings at a previous job.
      I did like the idea.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    24. Re:MUCH MUCH Much better solution by Anonymous Coward · · Score: 0

      You are ignorant of how mac osx works. It does this without having the need for a shell. It also has fast user switching which I'm sure you are clueless about.

    25. Re:MUCH MUCH Much better solution by Anonymous Coward · · Score: 0
      This is the second time I've heard vague references to "unpublished security holes" in Mac OS X, but every claim I've heard has been seriously short on content.

      No idea if it was published and only partially related to OSX, but...

      "setenv little-endian true" in Open Firmware on Powermacs is rather hard to reset on the systems that don't use a removable battery for their PRAM. Command-Option-P-R doesn't help, although there is an obscure keyboard combination that works (can't remember which).

      Changing that setting results in a system that still "bongs", but hangs with a black screen.

      Now imagine someone using some exploits to change the setting remotely on an Xserve. (Discaimer: No idea if this setting exists on G5-based systems).

  81. Re:Sudo is only useful when there are lots of admi by soft_guy · · Score: 1

    I use MacOS X. I'm not a big fan of using rm with wildcards. To make sure I know what I'm throwing away, I just type "open ." select the files, Command-Delete to throw them in the trash. Then, I can check what is in the trash and hit Command-Shift Delete to empty the trash. It seems to me that it is safer than using "rm *" or even rm "foo*.h". Then, I just hit Command-Tab to get back to terminal. It is actually quite fast.

    --
    Avoid Missing Ball for High Score
  82. Who said anything about file permissions? by Kaseijin · · Score: 1
    The point of visudo is two-fold. One is syntax check, the other is to ensure proper permissions are used on the file.
    The person in question changed the contents of /etc/sudoers to a syntactically valid configuration denying him sudo privs. visudo doesn't do anything to prevent that.
  83. some other advantages by Netmonger · · Score: 1

    Some other advantages to sudo:

    1. The user uses his/her own password to auth - no need to remember 2 passwords.

    2. You dont have to expose the actual root password among multiple administrators, and can thus use a complex mutual root password for a collection of servers.

    3. If you want to take away admin access for a single user, you can just lock his/her account. You dont have to go across 20 servers and change the root password! If you are using centralized password database this is even easier.

    4. You can revoke admin access without revoking user access.

    5. root shells work with the user's environment settings. When you execute a 'sudo bash' for example, you maintain your environment variables. Your 'home dir' is still *your* own dir - not root's. Things liks 'cvs' still continue to work.

    --
    -- NeTMoNGeR
    1. Re:some other advantages by m.dillon · · Score: 1

      Urm. Anybody who actually puts a password on the root account is already doing something stupid. In fact, anyone who allows remote shell logins to any account via passwords is really asking to be broken into. You basically should allow ssh access ONLY, and ONLY via a key pair, as a means of getting a shell prompt. In /etc/ssh/sshd_config (at least on BSD system), set 'PermitRootLogin without-password', set up the ~root/.ssh/authorized_keys file, allow only ssh access to all other accounts, restrict by IP or domain if appropriate, and you are done.

      no telnet, no rlogin, no rsh. Limit ftp to read-only (and disallow root logins, which should already be the default), etc etc etc. Every single entry in your password file should have its password '*' (i.e. no password access allowed), period, including root.

      To access the root account from other accounts set up ssh access individually from those accounts, restricted to localhost ssh logins only.

      Alternatively, or in conjuction with the above, for small systems, simply leave root without a password (i.e. ::), make sure that root logins via all services are disabled entirely (which is the default now for BSD systems), except from the console, and simply put the admin in the wheel group so he can 'su' to root, and you are done.

      sudo is really easy to abuse. Just having it installed on your system represents a major security hole. I recommend not using it at all.

      -Matt

  84. Better kill your scripting languages then, too. by Grendel+Drago · · Score: 3, Insightful
    There's more than one way to execute bash...
    user$ sudo perl -e'system("/bin/bash")'
    root#
    --
    Laws do not persuade just because they threaten. --Seneca
    1. Re:Better kill your scripting languages then, too. by Anonymous Coward · · Score: 0

      bash is yet another scripting language. Whatever you can do using bash, you'll be able to do it from perl, python or other scripting languages without needing bash. If you disable calling bash from perl, you can just do whatever you where gonna do from bash in perl.

  85. billy madison by DaFallus · · Score: 1

    and may god have mercy on the author's soul...

    --
    No one cares what your captcha was

    Houston TX, USA
  86. Sudo vs. Root by Clazzy · · Score: 1

    I'd think that this argument depends on the computer's usage. Sudo is much better for the average desktop computer or a small network, since it means that you can leave the computer logged in without any worries about someone messing it up, whereas being logged in as root could be hazardous. Of course, anyone who walks away from a computer logged in as root without locking it or anything doesn't deserve those privaledges.

    --
    If we can hit that bull's-eye, the rest of the dominoes will fall like a house of cards... Checkmate.
  87. Re:Sudo is only useful when there are lots of admi by aconkling · · Score: 1
    For a single-user system, sudo is pointless. Nearly everyone is just going to sudo into a shell to do anything where root is needed on their own personal box anyway.
    No.

    I recall arguing with someone in one of the Ubuntu IRC channels (back in my more vitriolic days) and they claimed that (arguably) the biggest draw for a desktop user using sudo is that things are separated very specifically. You access an administrative tool, for example, but that's the ONLY thing that you're doing with root access. As soon as you close that, you no longer have it at all. The same goes for anything else.

    I think that a root terminal is more important for anyone who's doing a lot of administrative commands at once, but this isn't a typical scenario for a desktop user. Mac OS and Ubuntu (the only Linux distro I know of that touts the "sudo for everything" attitude) are geared for non-technical desktop users.

    I used to hate sudo. However, I installed Ubuntu again in January and this time around I can appreciate using sudo a lot more. When I need to do "root stuff" at a terminal, I simply open the "Root Terminal" menu option under System Tools or su to root if I already have a terminal open. Otherwise, I just run commands with sudo or access things via the GUI (which runs gksudo). Very nice setup, if you ask me.

    The article's author seems to be geared towards a server environment, in which case I ask why he's using a default sudo setup in the first place. Hell, maybe sudo isn't even a good idea at all on a server....
  88. Sudo too much by PenGun · · Score: 1

    I dunno, I just su when I need to be root anywhere at all vulnerable. Log in as user and su if you need to ;).

          PenGun
        Do What Now ??? ... Standards and Practices !

  89. Re:Sudo is only useful when there are lots of admi by dubl-u · · Score: 1

    For a single-user system, sudo is pointless. Nearly everyone is just going to sudo into a shell to do anything where root is needed on their own personal box anyway.

    Wrong!

    I vary rarely run a shell from sudo. Even on my own boxes, I use sudo for perhaps 95% of my root activity. Why? Because then I have a complete log of everything I've done as root.

  90. double logins? by MikeFM · · Score: 1

    I always liked the system of requiring one user that has the password for the account that is allowed to sudo and another user having the password to sudo. So it takes two users to login and really do anything. Of course this is probably a bit paranoid. Would work even better with biometrics.

    --
    At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
    1. Re:double logins? by Kadin2048 · · Score: 1

      How about you encrypt the root password with a one time pad, and store the resulting ciphertext with someone off-site. Put the one-time-pad in a safe that requires to keys to open, and give each key to a separate trusted user. So when the you want to get access, all you have to do is call the person offsite, get them to give you their code, get the other user and open the safe, use that key to decrypt the password, and away you go.

      I'm telling you, it's fail safe.

      --
      "Ladies and gentlemen, my killbot features Lotus Notes and a machine gun. It is the finest available."
    2. Re:double logins? by Anonymous Coward · · Score: 0

      No, that's still too insecure. The phone call is especially vulnerable to man-in-the-middle attacks, and if mission: impossible (the TV show not the horrible movies) is any clue, so is the safe.

      Nay, it would be even more secure to encrypt with a secret passphrase (say, an entire novel worth of text) and the computer itself placed in the safe, covered in concrete, and lowered through four thousand fathoms of saltwater into an undersea volcano.

  91. Re:Sudo is only useful when there are lots of admi by hackstraw · · Score: 1


    I use sudo pretty much exclusively for root access. At the worst, I'll do sudo zsh and get a shell.

    Why would I do this, even if I'm the only admin?

    a) I don't have to know the root password.

    b) I have history of my recent commands that I ran as root in my shell

    c) my shell, path, environment and aliases are comfortable to me. Since I never screw with root accounts, who knows how screwed up the vendor left the account, or someone that worked prior to me

    d) its safer. I guess the exception is with !! or !s or whatever commands, but even the !s one will probably be hit with the password timeout.

    e) if I have to routinely go to root to do "normal" things, then the system is set up wrong, and I need to quickly fix that

    e is the big one here. I'm a sysadmin for my day job, and I rarely have to have root access. If I need to go to root all the time, then something is not set up right on the system. Usually a chown, chgrp, with a chmod will do wonders.

  92. Blurry image? by CCFreak2K · · Score: 1

    a closer look reveals a picture that is not so clear.

    Zoom out then. ;)

    --
    "Beware of he who would deny you access to information, for in his heart he dreams himself your master."
  93. Re:Sudo is only useful when there are lots of admi by CableModemSniper · · Score: 1

    Dude. Open . is totally sweet! Thank you I had no idea open worked with directories.

    --
    Why not fork?
  94. Re:Sudo is only useful when there are lots of admi by lp-habu · · Score: 1
    One thing I've done on most UNIX-like systems, including MacOS X, is to run a wild-card command first with 'ls' to see what files will really be affected, then edit the command to change the 'ls' to whatever it is I want to do, e.g., 'rm'.

    For example:

    $ ls *.pl
    anna.pl boris.pl vladimir.pl grigorij.pl
    Then as soon as I've confirmed that those are indeed the files on which I wish to act, ^P (or esc-k, or whatever) to retrieve the command, edit the 'ls' to 'rm' and go. Obviously, you can edit other parts of the command as well, but the important thing is never to edit the wildcard elements or attempt to re-type the command instead of editing. Re-typing can have errors; using the already used wildcard ensures that you'll get the results you want.
  95. Try these by Anonymous Coward · · Score: 0

    I have never used OS X. But i am guessing hte system is enough like linux since all the utils are hte same.

    a) sudo su

    b) sudo "cat /tmp/newconf > /etc/sudo.conf"
          sudo bash

    c) sudo passwd
          su

    Of course it logs the stuff on the local machine. So once your root you just merly need to remove / modify the log files. grep -v sudo should do it nice and cleanly

  96. Visudo should check by Paul+Crowley · · Score: 1

    Visudo should explicitly ask you "you are about to deny *yourself* root access. Are you sure?"

  97. Re:Sudo is only useful when there are lots of admi by Anonymous Coward · · Score: 0

    Can't do that - they're admins.

    Huh? Your system is set up so that all admins are root, or something?

    Even if for some reason you have a dumb setup that makes /etc/sudoers world-writable or something, you can still implement a policy that makes it a sacking offence to edit it. And then you set it up so sudo cannot be run interactively or launch a shell. And then you sack anyone who tries to get round the policy. Simple.

  98. anti MS troll by maynard · · Score: 1

    I bet you like to use $ with MS like M$. What's wrong with using Microsoft Word to edit /etc/passwd; /etc/shadow; /etc/pam.d/sshd; /etc/resolv.conf; etc etc etc? You're just biased against M$, that's why. Me, I prefer TECO. Where are the trolls out running DEC down? Huh?

    1. Re:anti MS troll by Anonymous Coward · · Score: 0

      Hardly, just Microsoft Word is not appropriate tool tobe editing config files with. I would have said the same for OpenOffice.org Writer. Again not an appropriate tool.

      Some sort of text editor would seem approriate for editing text files.

  99. Re:Sudo is only useful when there are lots of admi by Fulcrum+of+Evil · · Score: 1

    Huh? Your system is set up so that all admins are root, or something?

    Admins are necessarily authorized to do a sufficient number of things that they are guaranteed access to a root shell if they want it. What it comes down to is this: do you trust your admins?

    you can still implement a policy that makes it a sacking offence to edit it.

    How is this better than logbash? They'll still get shells if they need them.

    --
    "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
  100. Someone try this... by fireman+sam · · Score: 1

    Open an xterm (or the Mac OSX equiv)

    sudo su -

    and then for fun try: :(){:|:};:

    --
    it is only after a long journey that you know the strength of the horse.
  101. The author rather misses the obvious by @madeus · · Score: 1

    The article doesn't say that sudo isn't the most secure way to run commands, it just details how to make it even more secure.

    In doing so, I think the author fails to see the wood for the trees, in that if you want your account to be secure, you don't have to go through (admittedly pretty trivial) hoops to enable the root account and remove the "%admin ALL=(ALL) ALL" line from the sudoers file:

    You could just use a non admin level account (i.e. don't tick the 'enable this user' checkbox when creating the account - it is off by default on all secondary accounts created in Mac OS X, the end result being that the account is not in the 'admin' group).

    Going so far as to disable sudo for all admin accounts, but leaving it in the admin group strikes me as a bit 'fur coat and no knickers', and could leave users with a false sense of security (as there malicious things you can do to the system with access to any account in the admin group, none of which require any form of additional authentication to perform or have anything to do with sudo).

  102. Re:Oh, great! (ways around) by dotgain · · Score: 2, Insightful
    Even allowing people to
    sudo cat
    can get you screwed:
    sudo cat /home/evlusr/mypasswdfile >/etc/passwd
  103. I never liked sudo... by Anonymous Coward · · Score: 0

    ...it means "I sweat" in my mother language, Spanish. Eww!

  104. Take your point a bit further by kbielefe · · Score: 1
    You bring up an interesting point, and I think the other replies haven't gone far enough to address it.

    You argued that sudo is a vulnerable point when a browser or IM is compromised. Other people have addressed those potential weaknesses of sudo. I assert that a browser or IM process should never be able to run sudo in the first place, or for that matter, do anything other than maintain the bookmarks and preferences, read/write from a specific uploads/downloads directory, and launch a couple of viewer applications like acrobat reader and a media player.

    In other words, I find it ironic that people will go to great lengths to prevent root access when their most valuable data is freely accessible by a normal user. Although having root access is a definite bonus for an attacker, there is plenty of mischief that can be done with a regular account, especially for a targeted attack. For example, do you really care if someone can't get root on your machine if your banking, investments, schedule, address book, correspondence, private encryption keys, and photographs are all in your home directory?

    Whether you know it or not, you made a great case for mandatory access control as another layer of security in addition to properly configuring sudo and keeping your applications patched. A web browser should never have the same privileges as a shell, even if they are being used by the same person.

    --
    This space intentionally left blank.
  105. 0/10 Re:Oh, great! (ways around) by Anonymous Coward · · Score: 0

    That does not work. The redirection is not run as root. What happens is that "cat home/evlusr/mypasswdfile" is run as root but the redirection is done as the original user. Since the original user does not have permission to overwrite the account, you get an error, not a security exploit.

    1. Re:0/10 Re:Oh, great! (ways around) by Anonymous Coward · · Score: 0
      sudo "cat evlfile >/etc/passwd"
    2. Re:0/10 Re:Oh, great! (ways around) by dotgain · · Score: 1
      Whoops, I think the AC is right. After checking my facts with the sudo manual, you seem to need a subshell to get redirection to work.

      My bad.

  106. People don't crack passwords? by swillden · · Score: 2, Interesting

    Seriously. Nobody really cracks passwords anymore.

    Umm, this is dead wrong. Password attacks are getting more and more effective and popular among serious attackers all the time. Why? Very simple: because as computers get faster, passwords get weaker. If the attacker can get a copy of the encypted password file, he's home free, because peoples' ability to remember passwords has not kept pace with the ability of computers to search them. Barring that, any authentication service that doesn't do lockouts and delays (e.g. many web interfaces) provides an attacker with a great tool for password cracking.

    Note that this isn't an argument for or against sudo, because sudo also uses a password. It's just a different password. Sudo is valuable, but for other reasons.

    But don't fool yourself that password cracking isn't useful "anymore". It's very useful to attackers, and getting more useful all the time.

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    1. Re:People don't crack passwords? by TheCarp · · Score: 1

      > If the attacker can get a copy of the encypted password > file, he's home free, because peoples' ability to
      > remember passwords has not kept pace with the ability
      > of computers to search them.

      Yup....

      and thats the thing. Nobody runs big shell servers anymore, its generally hard enough just to get the encrypted password file, as it is to break in through some other means.

      Put another way, if someone can get hold of your shadow file, then you have bigger problems than anything that sudo configuration changes are appropriate to address.

      In any case, the real answer here is proper password management. sudo, setup in its normal way, is just fine if you can properly manage you rpasswords.

      You know what that means... you have a password, or set of passwords that NEVER go out unencrypted anywhere. They get used only over ssh sessions or ssl sessions etc.

      This may mean one password per system, or one password in total. Depends on the exposure risk of each system.

      Basically yes, if you send your system password that works fo rlogin and sudo out over the wire without encryption willy nilly or use it on random sites and systems that you don't control... then this is a huge risk to you.

      If you don't manage passwords, you are exposed to the risks of getting you rpasswords compromised. One way or another.

      Someone getting the shadow file is the least of your worries. Not because its no big deal if they get it, just because attacks aimed at getting it are rare when most attack vectors that would get you it, would just get you root just as easily.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    2. Re:People don't crack passwords? by Hawke666 · · Score: 1

      By "lockouts" you mean "DOS attacks" right?

    3. Re:People don't crack passwords? by swillden · · Score: 1

      Someone getting the shadow file is the least of your worries. Not because its no big deal if they get it, just because attacks aimed at getting it are rare when most attack vectors that would get you it, would just get you root just as easily.

      Access to the shadow file generally gets you passwords that provide access to other systems.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    4. Re:People don't crack passwords? by TheCarp · · Score: 1

      I was hoping nobody would notice that I was glossing over that. Admittedly, yes thats true.

      However, its again an issue of what we are talking about here. Are we talking about the machine on yourdesktop at home, or a large corperate environment. Are we trying to protect against a determined attacker with time and a reason to get in?

      You still need to know what other systems too. That may be easy to find,a nd often will be, I mean if you are in to the point of having the shadow file... you can probably look through the deamon logs and see where people ssh in from, or watch netstat output to see where they go to.

      This is all true. However, at some point, you have to decide how much of a threat you actually care about.

      Frankly, I think that if its that big a deal, maybe you shouldn't have passwords in shadow at all, except for root. Do some other authentication method that a single box being taken wont actually compromise the passwords so easily. (I am an ldap whore myself)

      What I would love to see is sudo which accepts RSA keys seprate from ssh.... then you can ssh in, do your thing, then load your root RSA key, sudo, and do what you need. Hell tie it to the same ssh agent through some means. You still have to worry about owned systems being used to hijack your session, but it only gets them an oracle, not your actual key...

      so if you say loaded the root ssh key only when you needed it, and such that it automatically gets unloaded within a few minutes... then the window of exposure is relativly very small, and very hard to predict.

      Again though, I maintain, once your user account is taken, if you use sudo, its only a matter of time before someone could have root access.

      I mean, would you notice your path was slightly different today than it was yesterday? especially if everything worked exactly as it did before?
      or do you always run sudo with an absolute path?

      If you said yes to either of those, you are by far in the minority, even among the best, most paranoid admins that I have ever worked with.

      Honestly... I was in a class where we were encouraged to break into eachothers boxes... and I did something much like that. Nobody noticed except the course instructor when he logged into the boxes one day to simulate a break in and noticed my changes to their box.

      and that was back before I had 5 years of professional experience under my belt, I bet if I wanted to do something similar today, it could be alot more clever.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    5. Re:People don't crack passwords? by swillden · · Score: 1

      What I would love to see is sudo which accepts RSA keys seprate from ssh.... then you can ssh in, do your thing, then load your root RSA key, sudo, and do what you need.

      You don't need to modify sudo, because sudo uses PAM for the authentication. I use a smart card with an RSA key pair to do sudo authentication on my machine. It's almost ideal, actually... I authenticate to the card (with a password) during the login process and then whenever I use sudo it silently authenticates using the key on the card (validating the public key with a root CA cert which is stored on the file system), so sudo usage is completely transparent to me and with the sudo timeout set to be very short (I use 30 seconds), sudo is disabled as soon as I remove the card.

      There are some disadvantages, though. SSH is a big one. Without some mechanism for forwarding the channel to the smart card reader, this only works on the local machine. In some circumstances that's a security advantage, but in most it's just inconvenient. I'm experimenting with ways to address this, probably via something like ssl-agent.

      From a security perspective, the big advantage is that no attacker can steal my key without stealing my card and obtaining my card password. Getting the password wouldn't be too hard given root on a box where I use the card, but I'd probably notice the missing card pretty quickly and revoke the cert (the PAM module downloads and checks a CRL), so the window of opportunity to extend the attack would be narrow.

      One other possible weakness in the present implementation which I need to explore is the possibility that users other than me on the same machine could use my card, after I've already authenticated to it and "opened" it. There's probably a mechanism in place to prevent that, but I need to look into it. This is all somewhat experimental at this point :-)

      I can also use the card to do challenge/response authentication againse a RADIUS server. I don't do that because my primary machine is a laptop, and without network access RADIUS authentication can't work.

      Once I've found a way to address the remote usage issue and verified that card access is restricted to my account, I think this will be a much better solution than any other I've seen.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    6. Re:People don't crack passwords? by TheCarp · · Score: 1

      God I am jealous.

      As for pam vs hacking sudo.... hmmm something to think about.

      Admittedly pam is a bit of a black box for me, its one of those things I have never needed to care so much about.

      But really.... how much do you care about your local machine like that? Now... realise, I am skewed... I use a laptop as my local machine...

      with encrypted root and swap... and running no services exposed to the network at all.

      Hell, the thing barely leaves my posession, I carry it nearly everywhere.

      That solves alot of worries. On top of that, I work on nothing and have access to almost nothing that anybody would target me for... so not much worry of keyloggers etc.

      So if I am worryign about security...its worring about my exposures on remote systems. A smartcard sudo that works only locally is of no use to me at all, the local machine is by far secure enough without it... and I almost never work locally on any machine that does matter. (even when I am on console, its through a console server)

      admittedly, if I had a smartcard like that, I would still totally set that shit up.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    7. Re:People don't crack passwords? by swillden · · Score: 1

      Admittedly pam is a bit of a black box for me, its one of those things I have never needed to care so much about.

      PAM is actually very simple, and very powerful. I think most of what makes it difficult to understand is that you tend to want to make it more complex than it is. PAM is very cool.

      But really.... how much do you care about your local machine like that? Now... realise, I am skewed... I use a laptop as my local machine... with encrypted root and swap... and running no services exposed to the network at all. Hell, the thing barely leaves my posession, I carry it nearly everywhere.

      My situation is comparable, personally, but I work as a security consultant for big corporations who require more flexibility. The smart card I'm working with is already used by my clients for lots of other things (login, secure e-mail, web authentication, etc.), so finding more ways to make use of the credentials on the card is very worthwhile.

      A smartcard sudo that works only locally is of no use to me at all

      Yep, that's a big problem, and one that I need to address to make this approach really useful.

      admittedly, if I had a smartcard like that, I would still totally set that shit up.

      :-)

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    8. Re:People don't crack passwords? by TheCarp · · Score: 1

      Aha!

      Theres the difference.... your a security consultant.

      We come from very different backgrounds. People like me don't even hire people like you.

      Why? Because none of the systems that I am responsible for so much as have credit card info on them, much less anything more sensitive (like medical data etc). This is true for most people (well, ok most peoples machines might have their own data on it.... ).

      Generally the attacks that I have to worry about are the general worms, and general script kiddie activities. You know, all you really have to do is not give them anything obvious and they don't even give you a second look.

      I have said many times, if a dedicated attacker with a reason to come in ever attacked a system that I was responsible for, then I have bigger problems than I am anywhere near prepared to deal with.

      Not that I couldn't be, or don't understand whats needed to "get there", just that its not a priority. For my systems, and the systems alot of us work with, that means going well past the point of diminishing returns.

      Not even that I wouldn't want to be, without support from management, you can only go so far. If you don't have the mandate to tell the users "tough deal with the inconvinence for security sake" then.... what are you going to do?

      This was my problem from the begining with the sudo thing... I understand that it does help a bit. It slows down an attacker (something I know I gloss over in my trojan scenario), and that IS something.

      However, its also past the point of diminishing returns for most of us. The loss of functionatliy (esp when coordinating between a number of admins, and operational groups etc) is of much bigger impact than the fairly marginal security benefit.

      anyway.... yah alot of things are like that. The config files are just really numerous and look a little intimidating with there terseness.

      Actually.... I just thought of another neat way around that without sudo... allow root ssh logins from localhost only (is there even a config option for that? hmmm)

      Then just make an alias for "ssh root@localhost"

      generate a root rsa key, toss it in roots authorised_keys.... then keep it local or on a keyfob.... and ssh-add it when you need it (could even have aliases for that too)

      Its not a perfect solution (a bit slow, and wont work if sshd isn't working, so its not as useful as it could be for fighting fires... but... for day to day stuff...)

      Shit you could have your system password for sudo really be used for nothing but root access.... and even then only in real emergencies.

      Havn't thought all the way through it... hmmm but I think I like it.

      and yah ssh-agent is cool... but if the remote box is compromised, it means they can hijack your ssh-agent session and use your keys for as long as its available... limits yoru exposure and doesn't let them actually get your keys... but still an exposure.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
  107. Re:Sudo is only useful when there are lots of admi by soft_guy · · Score: 1

    That sounds like a good method as well.

    --
    Avoid Missing Ball for High Score
  108. Re:Sudo is only useful when there are lots of admi by soft_guy · · Score: 1

    One of the most useful things I have created for using MacOS X is an AppleScript that opens a new terminal window located at the path of whatever Finder window is at the front. Then, I just add the script to the "Scripts" folder (after activating the AppleScripts menu item. Then, I have an easy way to get from the finder to the terminal (picking my AppleScript off the menu bar) and from the terminal to the finder (using "open").

    The source for my AppleScript is:

    tell application "Finder"
            set x to target of front window as text
            set y to POSIX path of x
    end tell

    tell application "Terminal"
            do script "cd \"" & y & "\""
            activate
    end tell

    To activate the AppleScript menu, you go to /Applications/AppleScript/, then open "AppleScript Utility" and check "Show Script Menu in menu bar" and uncheck "Show Library Scripts" then choose "Open Scripts Folder" and drag the applescript above into that location and it will be in the Scripts menu.

    I figure if you are the kind of person to think using "open ." is useful, you'll probably like this idea.

    --
    Avoid Missing Ball for High Score
  109. You're wrong - see sudosh by poopie · · Score: 1

    We use sudo extensively for a large environment with many admins and many developers who think they need root equivalency on every server they log into.

    There is a good tool that is a middle ground between forcing users to type sudo $COMMAND for every command and between just giving up a root shell and encouraging users to do 'sudo su'

    It's sudosh - it provides the ability to get a root shell session where every command and its output is recorded.

    http://sudosh.sourceforge.net/

  110. Sudo is a role based enabler by theendlessnow · · Score: 1
    Sudo is not about "securing" root, but rather allowing access to root... or other id to run programs. It has everything to do with ALLOWING access. It's main purpose is to try to end anonymity and the stepping on toes by multiple admins, and to allow users to execute certain programs as someone else (e.g. root).

    If you want to secure the box, you need to RESTRICT (DISALLOW), instead of ALLOW.

  111. OMG: its a joke by maynard · · Score: 1

    I thought a reference to TECO would have clued you in. No, I do not use MS Word to edit config files.

    What happened to /.? We need another OOG_THE_OPENSOURCE_CAVEMAN. "I WILL BEAT YOU WITH MY OPENSOURCE CD!!!"

  112. sudo to a shell by Old+Admin · · Score: 1

    I agree, there are different requirements between workstations and multi-user servers. SUDO tends to be more useful on servers. One of the additional tools I like to use with SUDO is sudosh. Sudosh is a "shell" that logs everything, so you can avoid the "admin gets tired of typing sudo in fromt of everything and just spawns a shell" problem. They can spwarn a sudosh, and then do what they need to do, and I can still get an audit log. Which brings up another point, sudo provides an audit log, and from a forensic inventigation point of view, this is rather handy. Now, this also implies that your logs get sent to another machine which very few people have access to. Again, all this implies that you are running servers, and more than one server at that.

  113. You can always "sudo su" under OSX. by Archeopteryx · · Score: 1

    Even without enabling the root account this works.

    There are a very few things I do that way...

    --
    Dog is my co-pilot.
  114. How about SELinux (or Mandatory access controls) by dazby · · Score: 1

    If you use MAC/MLS type stuff like selinux (not for OSX obviously), root can be just another user, with some extra freedoms depending on circumstance (not all powerful regardless)

    As an example, my understanding (not a guru) is in selinux, you don't have to be root to listen on port 80. If you do start it as root, the app has a system enforced policy that determines what it can do. ie it can listen on port 80, but only write to certain files, not make tcp conections (unless allowed etc). The rights aren't of the starting user, but of the application itself.

    When this is applied to sudo, the command you run can be restricted in its operation depending on system policy. I think that the final effect depends on who you logged in as, and how that login context is allowed to change when running sudo. ie some users will be able to run a process via sudo and have it take on all its power, but others will not be able to run it with privileges beyond their own (or some subset of the max for the apps policy)

    Some posts have talked about renaming/hiding bash for example. In a full selinux environment, when sudo launces bash (or any app as uid of root), it has no more privilege than system policy allows. If you create your own bash, it only has the security privs that you do, even if launched by sudo. You may end up with uid=0, but contained by your login priveleges. Some users can be assigned extra rights and can do more.

    Once again, not a guru - have played a little with it in Fedora Core 4 (enforcing mode, targetted policy), which still allows sudo to do anything, via a selinux aware sudo. I beleive that there is a way that you can make it less transparent, and more secure, but as always security policy is a trade-off between usability and absoulte security. I'm happy(ish) knowing that I have strong password policy for my server and that selinux *helps* stop a compromised app operating outside of its intended policy. However, if you have the password to a sudo unrestricted user, all bets are off. When I'm more comfortable with selinux, I will find out how to wind back sudo and require manual changes in my initial security context before doing particular tasks (like changinf application selinux tagging).

    I like what i've seen in selinux so far. Some new stuff to learn, and some things still to win me over, but it is a step in the light direction.

  115. Admin and OSX by CottonEyedJoe · · Score: 1

    I tried to give up admin on my primary OSX account but in the end it not worth the trouble considering the security risk to my firewalled home network. For an average user its probably not that big of a deal, but trying to do Java development in Eclipse, starting and stopping web servers and tomcat, moving files around, adjusting privs to get things to work right from a normal acct. It was just a huge hassle. It would take me literally 10 times longer to do some tasks. On OSX its not as simple as sudo this or that, and for me it wasnt worth the hassle.

    Whats my exposure by using an admin acct? If I were a dumbass who opened every file emailed to me and couldnt see that there was something wrong with a jpg image needing my password, then I might be in trouble. But I'm not, so I'll risk it. As an admin user I havent found the need for the root acct. Anything I would need root to do is easily done via sudo.

  116. Re:Sudo is only useful when there are lots of admi by Iaughter · · Score: 1

    I work in a network with 4 1/2 admins, myself included. Notably two of them get so irritated at having to type sudo before every command that they'll just sudo into a shell and be done with it. However, we got sudo configured to last for five minutes or so, so that once you authenticate using sudo, only five minutes of sudo inactivity will require you to re-authenticate. I find that it works well. And of course, there's the extra benefit of not becoming innured to being root.

  117. this guy is out of his mind by hashkaran · · Score: 1

    sudo is 1000 times better than having "root" enabled. First with root disabled somebody has to guess the the correct admin "user id" and "password". Which is more difficutlt than just guessing the password for root. Considering the environment where multiple admins control the machine sudo is only way for accountability.

  118. that's a "default-allow" policy by BerkeleyDude · · Score: 1

    %usergroup ALL=(ALL) ALL,!SHELLS,!SU,!SHUTDOWN,!HALT

    This is called a default-allow policy. It's not going to work. You can't enumerate every possible way of executing a shell on a UNIX system.

    If you want a really secure system, enumerate the "safe" commands, and allow them to be executed. Of course, it's going to be a pain - but you decide whether you want security or convenience. It's hard to have both.

  119. Re:Sudo is only useful when there are lots of admi by Anonymous Coward · · Score: 0

    useful, thanka

  120. Use sudo to grant root to a single user by Macka · · Score: 1


    Another derivative of that is when sudo is used to temporarily grant access to root privs. As a consultant who travels around between different customer sites a lot, I sometimes visit customers who set me up my own permanent user account, then turn on sudo access when I get there, and turn it off when I leave. Works very well for all concerned. Much less work for them and less waiting around for me.