Linux - any way to make a desktop icon for a sudo command?

Discussion in 'Linux' started by jonboy99, Jan 26, 2009.

  1. jonboy99

    jonboy99

    Joined:
    Oct 1, 2008
    Messages:
    3
    Likes Received:
    0
    Hi folks, i've been following the how-tos in the bluetooth forum and am now happily using my phone as a 3G modem. One slight problem is, I need to be superuser to open the dialler program, which means opening the terminal and typing in 'sudo gnome-ppp'

    Now this isn't too much of a hassle, but is there a way I could put this into a script, so I could make an icon on the desktop shortcut to it, without needing to type in my su password each time?

    I don't want the command to run at bootup because at home I use wifi rather than 3G and don't want the window popping up when not needed.

    Thanks
    Jon
     
    jonboy99, Jan 26, 2009
    #1
  2. jonboy99

    markh

    Joined:
    Oct 6, 2008
    Messages:
    299
    Likes Received:
    0
    If you already know how to make an icon, then you ought to be able to just have exec=sudo gnome-ppp in the .desktop file. I have a sudo thunar icon in a similar vein. Mind you, there could be some deep linux reason why it would work for thunar but not your prog.

    Incidentally, if you want to get really complicated, it is possible to write a script that detects if wifi is connected or not, and executes commands accordingly. In theory you could have one to check for wifi connection and then launch 3g if you're not at home. Some details here, if you'd like to spend a lot of your time to save one click.
     
    markh, Jan 26, 2009
    #2
  3. jonboy99

    Japser

    Joined:
    Aug 28, 2008
    Messages:
    267
    Likes Received:
    0
    You can solve this by adding yourself to the group 'dialout'.
    ( Not sure about this groupname )

    A command like

    usermod -aG dialout user

    should add the user 'user' to the group dialout.

    It works only after logging out and in again.

    --Japser.
     
    Japser, Jan 27, 2009
    #3
  4. jonboy99

    redtree

    Joined:
    Nov 8, 2008
    Messages:
    14
    Likes Received:
    0
    You need to open up the file /home/user/.config/xfce4/desktop/group-app.xml

    Then add this line to the group that you want to add the Gnome PPP icon to (mine is in Connect).
    Code:
    <app sequence="3">/usr/share/applications/fedora-gnome-ppp.desktop</app>
    This will add the Gnome PPP icon to your desktop. You may have to change the sequence number (3 in my case) if you get icons overlapping on the desktop.

    I've not got Gnome PPP to connect to my mobile without running as root so if you find out how let me know!
     
    redtree, Jan 28, 2009
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.