sudo, su, sudo su, sudo su -l???

Discussion in 'Linux' started by Guest, Nov 3, 2008.

  1. Guest

    Guest Guest

    How do you know when to use one or the other?
     
    Guest, Nov 3, 2008
    #1
  2. Guest

    daldred

    Joined:
    Aug 25, 2008
    Messages:
    887
    Likes Received:
    0
    They all provide ways of running commands as root (or, technically, as any other user - but since the One comes with only "root" and "user" as user accounts, it's not very relevant to the One!).

    sudo <command> : do this command (only) as root.

    su : change to be the root user in the present console. This means that all the commands you now enter will be run as root, until you either close the console window or log out as root (Ctrl-D, or exit, will log you out as root but leave you logged into the console as yourself). This requires the root password, but by default on the One this is set to the same password as the user password.

    sudo su : if you don't know the root password (not usually an issue on the One), this allows you to run the su command without a password. Note that this is simply sudo with the command of 'su'.

    sudo su -l : change to user, but with whatever shell environment the root user would usually have. Again, not likely to be all that useful on the One unless you're doing something odd - or have seriously screwed up your own shell environment (in which case this may not work anyway!).

    Practically, sudo makes you root for one command; if you've lots to do as root, then use su. But always remember than using root privileges has its dangers; from this point of view using sudo is often preferable as it makes you type it every time so you don't forget you're using the root account.

    On more mainstream Linux systems, you would usually need to enter your own password to use sudo, and there would often be limitations on just what you could do using sudo as well. Linpus as distributed by Acer allows any user to run any command as root without a password. This makes things easy, but from a security point of view is not really a Good Thing!
     
    daldred, Nov 3, 2008
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.