Find the answer to your Linux question:
Results 1 to 6 of 6

Thread: root vs su

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    root vs su

    During almost ever FAQ, HOW-TO, Guide, and post i see where you must be root, i notice almost all of them suggest using a standard user, then su'ing to root.

    I can see where this might be a better idea for non-admin users, but in my expirence su'ing is not a good option to administering a linux machine.

    A teacher once told me "Admining linux without root, is like driving a car without arms, yes you can get root access with SU, but do you put your arms on after you start driving?"

    .. My purpose to this post is to ask,

    What do you recomend? Login as root, or just su?

    It seems to me, SU'ing will add more 'red tape' to administartion.

    Whats your views?


  2. #2
    Linux Newbie
    Join Date
    May 2004
    Boston, MA
    If you always stay logged in as root, you will make a horrible mistake, and you will regret it. I find that using the "sudo" package gets everything I need done. I can edit documents with "sudo vim /etc/fstab" or run root-only programs like "sudo iptables", with no problems. I think it's always best to stay logged in as a regular user and only log in as root when absolutely necessary, which is rare.

    Besides, if you had seen "I, Robot", you would know that driving without your arms is much safer than driving with them.
    Situations arise because of the weather,
    And no kinds of love are better than others.

  3. #3
    Linux Guru kkubasik's Avatar
    Join Date
    Mar 2004
    Lat: 39:03:51N Lon: 77:14:37W
    one of linux's primary defenses is the root password, if someone gets control of your computer then they can't affect your system, of course unless you are always logged in a root.... I think its a matter of personal preferace, I use su as i do most access remotly, even thought i use ssh, its just in my head i guess, i dont want to be root any longer than nessicary.
    Avoid the Gates of Hell. Use Linux
    A Penny for your Thoughts

    Formerly Known as qub333

  4. $spacer_open
  5. #4
    I can understand both views.

    I guess, sudo would be a better route in a secure enviroment... but, at home, when im just messing around, ill still just login as root.

    and i havnt seen I, Robot, lol. Is it worth watching? I was going to watch it this past saturday but went with Bourne Supremacy instead.

  6. #5
    Linux Enthusiast scientica's Avatar
    Join Date
    Sep 2003
    South- or "Mid-" Sweden
    Quote Originally Posted by rathergoodman
    I guess, sudo would be a better route in a secure enviroment... but, at home, when im just messing around, ill still just login as root.
    That's how I did it my first time in linux - though, I'm surpised I didn't whipe my disk clean...
    It's much safer, both from intruders and from you (no offence).

    There is three ways to become root:
    • sudo - allows you to run a command as root, but you must be in a speciall list file over users allowed to use sudo (iirc, /etc/sudoers). you can configure it to allow you to run somethings as root without having to enter the root password or your own account password when running something like "sudo somecommand", and you can make it ask for the root password.
    • su asks you for root password - always - and when run as "su" in a terminal you'll become root untill you type "exit". You can run it as "su -c 'command'" if you only want to run a single command as root, though a propperly setup sudo is probably better if you only intend to run a few commands as root.
    • su - as above, but the hyphen "-" also loads the root users enviroment, so eg "~" no longer points to you home dir, but to /root. the $PATH also includes the sbin dirs.

    So in short, I stronly advert from loggin on as root, I think it's better to even set the roots login shell to nologon - but that's not important if you only want to tty linux out.
    The main advantage of having a "second user" which you sue to login with is that you'll reduce the risc of accidentally messing up the system, something which is rather easy if you think like, hmm, what does this command do, maybe I should try run it (before I read the manpage or try "command --help", (or -h or -help))
    Regards Scienitca (registered user #335819 - )
    A master is nothing more than a student who knows something of which he can teach to other students.

  7. #6
    Linux Engineer
    Join Date
    May 2003
    Greece / Athens
    good reply scientica!
    Linux For Ever!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts