FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 04-16-2010, 09:12 PM
John DeCarlo
 
Default Sudo vs. root

On Fri, Apr 16, 2010 at 4:54 PM, Dotan Cohen <dotancohen@gmail.com> wrote:


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.

There is absolutely a difference.* If I were smarter, I would give you a URL that explains all the technical details.

Have him log on as a regular user, go to the command line, type "sudo -i" then try the app.* It should work.*



"sudo -i" makes you root, gives you $HOME of /root, loads the /root/.profile and whatever.*
--
John DeCarlo, My Views Are My Own


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-16-2010, 09:30 PM
Brian McKee
 
Default Sudo vs. root

On Fri, Apr 16, 2010 at 4:54 PM, Dotan Cohen <dotancohen@gmail.com> wrote:
> 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.

Seems to me the issue here really is how he's starting it.
It should start itself so to speak.

Put it in /etc/init.d/rc.local or /etc/crontab or whatever and let the
system itself start it.

If for some reason he really has to start it manually, try 'sudo -i'
to get a root prompt and run it from there. I *think* that will get
all your ENV variables the way required.

Brian

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-16-2010, 09:43 PM
NoOp
 
Default Sudo vs. root

On 04/16/2010 02:30 PM, Brian McKee wrote:
> On Fri, Apr 16, 2010 at 4:54 PM, Dotan Cohen <dotancohen@gmail.com> wrote:
>> 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.
>
> Seems to me the issue here really is how he's starting it.
> It should start itself so to speak.
>
> Put it in /etc/init.d/rc.local or /etc/crontab or whatever and let the
> system itself start it.
>
> If for some reason he really has to start it manually, try 'sudo -i'
> to get a root prompt and run it from there. I *think* that will get
> all your ENV variables the way required.
>
> Brian
>

These may be of help also:
https://help.ubuntu.com/community/ServerFaq
https://help.ubuntu.com/community/RootSudo
https://help.ubuntu.com/community/Sudoers
https://help.ubuntu.com/9.10/index.html
[Ubuntu Server Guide (PDF version)]


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-16-2010, 10:24 PM
Florian Diesch
 
Default Sudo vs. root

Dotan Cohen <dotancohen@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.

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.

Try
sudo -i command
or
sudo bash -c command
or
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.


Florian
--
<http://www.florian-diesch.de/linux/asciipinguine.html>

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-17-2010, 07:13 AM
Luis Paulo
 
Default Sudo vs. root

not sudo -l, that doesn't work for this

Are you thinking about su -l root -c "command args"?

or sudo su -l root -c "command args"?

Or am I missing something?



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-17-2010, 07:49 AM
Dotan Cohen
 
Default Sudo vs. root

On 17 April 2010 00:12, John DeCarlo <johndecarlo@gmail.com> wrote:
> On Fri, Apr 16, 2010 at 4:54 PM, Dotan Cohen <dotancohen@gmail.com> wrote:
>>
>> 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.
>
> There is absolutely a difference.* If I were smarter, I would give you a URL
> that explains all the technical details.
>
> Have him log on as a regular user, go to the command line, type "sudo -i"
> then try the app.* It should work.
>
> "sudo -i" makes you root, gives you $HOME of /root, loads the /root/.profile
> and whatever.
>

I see, thanks! I did read the sudo manpage but that was not clear.

--
Dotan Cohen

http://bido.com
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-17-2010, 07:50 AM
Dotan Cohen
 
Default Sudo vs. root

> Seems to me the issue here really is how he's starting it.
> It should start itself so to speak.
>
> Put it in /etc/init.d/rc.local or /etc/crontab or whatever and let the
> system itself start it.
>

Exactly what I was thinking, and what I plan on doing what I get there!


> If for some reason he really has to start it manually, try 'sudo -i'
> to get a root prompt and run it from there. *I *think* that will get
> all your ENV variables the way required.
>

Thanks!

--
Dotan Cohen

http://bido.com
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-17-2010, 07:56 AM
Dotan Cohen
 
Default Sudo vs. root

> These may be of help also:
> https://help.ubuntu.com/community/ServerFaq
> https://help.ubuntu.com/community/RootSudo
> https://help.ubuntu.com/community/Sudoers
> https://help.ubuntu.com/9.10/index.html
> [Ubuntu Server Guide (PDF version)]
>

Thank you! I have read the ServerFAQ, I will read the rest. I am
particularly bothered that the RootSudo page did not come up in my
googling.


--
Dotan Cohen

http://bido.com
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-17-2010, 07:59 AM
Dotan Cohen
 
Default Sudo vs. root

> Try
> *sudo -i command
> or
> *sudo bash -c command
> or
> *sudo bash * #and start the program at the prompt
>

Thanks. For the archives, "sudo su" works as well, once a root
password has been set.


--
Dotan Cohen

http://bido.com
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 04-18-2010, 01:48 PM
Markus Schönhaber
 
Default Sudo vs. root

16.04.2010 22:54, Dotan Cohen:

> 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.

As others already noted, the difference is probably the environment set
by sudo.
OTOH, the really important thing from a security point of view is: thou
shalt not run applications as root unless absolutely necessary. And,
moreover, as a rule of thumb, applications which are accessible via an
untrusted network must not be run as root.
Your neighbour may be affected by the problem that listening on ports <
1024 requires root privileges. But there are workarounds, among them:
- Use procrun / jsvc, which is, for example, bundled with upstream
Tomcat and allows a Java application drop privileges after having
completed privileged tasks.
- Let the application listen to an unprivileged port and create
netfilter rules to redirect the traffic from an privileged port.

http://wiki.apache.org/tomcat/FAQ/Security#Q3

--
Regards
mks

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 12:58 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org