How to make everything run as root in ubuntu?

6,281

First enable the root account by setting a password:

sudo passwd

Then enable manual login in LightDM (assuming 14.04):

sudo tee /usr/share/lightdm/lightdm.conf.d/50-allow-manual.conf <<EOF
[SeatDefaults]
greeter-show-manual-login=true
EOF

Restart LightDM:

sudo service lightdm restart

Login as root. You'll have to type both username and password. To enable autologin for root:

sudo tee /usr/share/lightdm/lightdm.conf.d/51-auto-root.conf <<EOF
[SeatDefaults]
autologin-user=root
autologin-user-timeout=0
user-session=ubuntu
greeter-session=unity-greeter
EOF
service lightdm restart
Share:
6,281

Related videos on Youtube

Gizmo
Author by

Gizmo

Edited.

Updated on September 18, 2022

Comments

  • Gizmo
    Gizmo over 1 year

    I have setup a virtual machine for compiling software for linux which I develop on Windows.

    I setup to automount a windows folder, run compilation scripts and then just shutdown. The machine isn't even connected to a network.

    I have read a few question to answer it myself but the only thing I can make happen is that I do not have to type in a password and auto login my user in ubuntu.

    But what I want to do is: I want to execute a command in the terminal. I want it to execute with root privilidges, every command and always under any circumstances. I do not want to type "sudo" or "su" every time I go to the console to compile my programs (some scripts require root privilidges, some not, you don't know until you run it and a bunch of errors appear which makes it really frustrating).

    So how do I do this?

    Optional: How can I make everything in the default Ubuntu GUI also run as admin? Eg gedit when double clicking on a file?

    Proclaimer
    I looked for other answers about this topic but they do not answer the question. Every answer denies an correct answer on a "it's not secure" basis (even though users state most of the times they are aware of the security risks)... and I do not care about a non-networked OS's security. It's just a matter of loading a previous snapshot of the compilation VM if anything breaks.

    • Alaa Ali
      Alaa Ali almost 10 years
      Enable root login using the above link question, and sign into the GUI using username root and the password you set for it.
    • Gizmo
      Gizmo almost 10 years
      I do have to log in AS root? Can't do this for my own account? Well okay.
  • Gizmo
    Gizmo almost 10 years
    ah finally, I wanted it to login automatically so I edited /etc/lightdm/lightdm.conf to login root automatically, nice, thanks again! :)