Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Richard, Thomas W., Warren Hill, Alaa Ali, Eric Carvalho Aug 5 at 16:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Enable root login using the above link question, and sign into the GUI using username root and the password you set for it. –  Alaa Ali Aug 5 at 12:17
    
I do have to log in AS root? Can't do this for my own account? Well okay. –  Gizmo Aug 5 at 17:16

1 Answer 1

up vote 1 down vote accepted

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|improve this answer
    
ah finally, I wanted it to login automatically so I edited /etc/lightdm/lightdm.conf to login root automatically, nice, thanks again! :) –  Gizmo Aug 5 at 17:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.