Sudo vs. root
diesch at spamfence.net
Fri Apr 16 22:24:21 UTC 2010
Dotan Cohen <dotancohen at gmail.com> writes:
> I have a neighbor who runs some Java server on his Ubuntu machine. He
> actually logs into the GUI as root and then runs the server from the
> terminal. He is no computer guru, this is how he was taught to do it.
> He insists that he has tried to start the server with sudo from a
> regular user account, but that it "doesn't work": it starts but does
> not serve. I will go over there on Sunday to take a look at the
> machine, but before I go I'd like to know if there is any real
> difference between running an application as root vs. running with
sudo runs the application as root, just like if you run it from any
other program running as root. But as sudo doesn't execute a shell but
runs the program directly the environment is most likely different from
the one in a root shell.
sudo -i command
sudo bash -c command
sudo bash #and start the program at the prompt
The first one starts root's shell as login shell (unlike the GUI), the
second as non-interactive shell (unlike the terminal). Both influences
what config files are read by the shell - see the man page.
The last one should be the same as using a root terminal.
More information about the ubuntu-users