Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Run-As-Root desktop shortcut

  1. #1
    Join Date
    Apr 2008
    Location
    Bundaberg, Qld
    Beans
    140
    Distro
    Ubuntu 20.04 Focal Fossa

    Run-As-Root desktop shortcut

    It used to be possible to have a shortcut on the desktop, that you could click and drag a file/directory to from a file manager, a pop-up would then allow you to sudo, and the result would be an editor/file manager, logged in with root privileges (sooooo handy.)
    Believe it used gksu %u , or similar to do the trick.

    Realise that gksu is not generally available these days, but is this still possible using a different utility?
    Thanks.
    Kubuntu 20.04 x64 / Opensuse LEAP 15.2
    i5 / 16GB
    Onboard graphic/sound

  2. #2
    Join Date
    Dec 2014
    Beans
    1,727

    Re: Run-As-Root desktop shortcut

    A drag-and-drop capable shortcut for editing could use something like
    Code:
    env EDITOR=/usr/bin/mousepad SUDO_ASKPASS=/usr/bin/X11/ssh-askpass sudo --askpass -e %F
    This uses 'sudo -e' which - just like sudoedit - copies a file, runs an Editor (chosen through the environment variable EDITOR) on the copy then copies the edited file back. This has the advantage of not running an editor as root. It uses ssh-askpass from the package from the package of the same name to ask for the password in a graphical form.

    Holger

  3. #3
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Run-As-Root desktop shortcut

    I don't think Gnome3, the default DE on Ubuntu, allows desktop icons. There may be an addon for Gnome3 to enable this or you can use some other DE which does support desktop icons.

    But really, you can just use sudoedit.

  4. #4
    Join Date
    May 2010
    Beans
    1,204

    Re: Run-As-Root desktop shortcut

    Could use nautilus-scripts to do same (I assume Gnome here). Sounds pretty useful for GUI kids

  5. #5
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Run-As-Root desktop shortcut

    Nautilus Python scripts here

    e.g. open-as-root.py

  6. #6
    Join Date
    May 2010
    Beans
    1,204

    Re: Run-As-Root desktop shortcut

    Quote Originally Posted by dragonfly41 View Post
    Nautilus Python scripts here

    e.g. open-as-root.py
    Pretty much what I said, just more exact

  7. #7
    Join Date
    Oct 2005
    Location
    Lab, Slovakia
    Beans
    10,307

    Re: Run-As-Root desktop shortcut

    Note that for small utilities, there is a method called suid root. A little googling for "linux suid root" will find you more information.

    On an engineering machine, it is useful to set the network utilities such as ifconfig, ip, route and a few others to suid root. What will then happen is that the utility will run with root permissions when launched from a common user account, without the need to invoke sudo or similar annoyances.

    For a computer used by an unsophisticated user in an office environment, this is not a good idea, so these utilities are not set that way by default.

  8. #8
    Join Date
    Apr 2008
    Location
    Bundaberg, Qld
    Beans
    140
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Run-As-Root desktop shortcut

    So... am I getting thicker and thicker... Sorry, coming from Opensuse (and may be going back )
    Does drag'n'drop to open a file with an app, not work at all by default in Gnome? ie can't drag and drop a file on an executable, to open that file?
    Kubuntu 20.04 x64 / Opensuse LEAP 15.2
    i5 / 16GB
    Onboard graphic/sound

  9. #9
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Run-As-Root desktop shortcut

    Does drag'n'drop to open a file with an app, not work at all by default in Gnome? ie can't drag and drop a file on an executable, to open that file?
    Personally I don't follow that drage&drop workflow. Instead I use a tool (in my case Krusader dual-pane file manager), right click and select from list .. Open With. Then a list of relevant apps show. You can adapt this workflow to suit.

    Also in Krusader I can open file with root permissions when needed, but largely I use in local user mode until I really needed root.

  10. #10
    Join Date
    Apr 2008
    Location
    Bundaberg, Qld
    Beans
    140
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Run-As-Root desktop shortcut

    Think I'm going to head back to Opensuse for a while.
    Although I quite like the way ubuntu/gnome works, and have been persevering with it for a month or so, now, I don't like the current 'disabled' desktop.
    Will try again later....
    Kubuntu 20.04 x64 / Opensuse LEAP 15.2
    i5 / 16GB
    Onboard graphic/sound

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •