Re: sudo vs. gksu



On 04/06/2008 12:37 AM, Michael R. Head wrote:
On Sat, 2008-04-05 at 15:28 +0200, Mario Vukelic wrote:
On Sat, 2008-04-05 at 14:11 +0100, Tony Arnold wrote:
Can you explain how this problem is avoided with gksu, or gksudo? So far
as I can see using one of these causes the application to run with UID
of 0, i.e., root. The app has no knowledge of how it was invoked, so any
files is creates will be owned by root.

Your explanation applies to running any app, not just graphical ones.

http://www.psychocats.net/ubuntu/graphicalsudo

That page says that "sudo nano /etc/apt/sources.list" is a good idea.
It isn't, and for the same reason graphical apps shouldn't be run
through sudo -- nano will create/edit extra files in your home
directory. In fact, there's a command called "sudoedit" which solves the
problem.




Good catch.
sudoedit invokes the -e command (as in sudo -e):

http://linux.die.net/man/8/sudoedit
<quote>
-e

The -e (edit) option indicates that, instead of running a command, the
user wishes to edit one or more files. In lieu of a command, the string
"sudoedit" is used when consulting the sudoers file. If the user is
authorized by sudoers the following steps are taken:
1.

Temporary copies are made of the files to be edited with the owner
set to the invoking user.

2.

The editor specified by the VISUAL or EDITOR environment variables
is run to edit the temporary files. If neither VISUAL nor EDITOR are
set, the program listed in the editor sudoers variable is used.

3.

If they have been modified, the temporary files are copied back to
their original location and the temporary versions are removed.
If the specified file does not exist, it will be created. Note that
unlike most commands run by sudo, the editor is run with the invoking
user's environment unmodified. If, for some reason, sudo is unable to
update a file with its edited version, the user will receive a warning
and the edited copy will remain in a temporary file.
</quote>


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



Relevant Pages

  • Re: How to find & test device/demon used by audio app?
    ... >> to see the command line to start the app if you don't know it already. ... > I have not seen a menu editor since Red Hat Linux 7.3. ...
    (comp.os.linux.misc)
  • bringing ee up to date
    ... -is a simple screen oriented text editor. ... +.\" To format this reference page, use the command: ... -Turn off display of information window at top of terminal. ... -.Ss "Control keys" ...
    (freebsd-hackers)
  • Re: Typography
    ... Sounds more to me as if there wasn't a straightforward LaTeX ... which editor to use. ... There never would have been one standard - obviously. ... old command line stuff had had its day. ...
    (uk.comp.sys.mac)
  • Re: Programming "efficiently" on given hardware - what does it mean really?
    ... >> in a command line world again. ... > launching an app, selecting menu items, hoping it does what ... In a GUI environment, use a RAD tool to whip up a quick, simple UI ...
    (comp.programming)
  • Re: Difference between VC++ and UNIX
    ... grammar that describes how you interact with the editor. ... One way to think of this is that every command you can give the editor ... if I type C-x in emacs, that puts me in a state where typing "u" ... will be in a state where a keypress inserts the literal character. ...
    (comp.programming)