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

Thread: Create Desktop Launcher and include sudo password?

  1. #1
    Join Date
    Dec 2007
    Beans
    386
    Distro
    Ubuntu 10.04 Lucid Lynx

    Create Desktop Launcher and include sudo password?

    Hi. I'm using Xampp for some development work and I have two launchers on my desktop, one to start Xampp and one to stop it.

    Xampp needs to be started with sudo, so I have: "sudo /opt/lampp/lampp start" as the command in one of the launchers. However, its a pain to keep typing the password, so is there a way to include the password for sudo inside the launcher (so I can just click it and go)?

    Cheers

    Max

  2. #2
    Join Date
    Dec 2007
    Beans
    386
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Create Desktop Launcher and include sudo password?

    Just a 'lil old bump!

  3. #3
    Join Date
    May 2009
    Location
    Lancaster, PA
    Beans
    1,334
    Distro
    Ubuntu Development Release

    Re: Create Desktop Launcher and include sudo password?

    The only way I could think of getting the same result you're looking for is to create a launcher script, and give it root permissions.

    open gedit (or any other plain-text editor)
    and type the following:

    Code:
    #!/bin/bash
    /opt/lampp/lampp start
    Save it to your desktop, then right click the icon. Properties>Permissions.

    Select 'execute'

    and you should be good from there!

    Repeat the process with the 'stop', you simply have to edit the 2nd line in the script, natch.

    Hope this helps!
    Java Guide Media support Flash x64 Grub2 Get Dropbox! My Look! RSync Twitter

    "Windows 7 was my idea"- I guess Microsoft enjoys copyright infringement?

  4. #4
    Join Date
    Dec 2007
    Beans
    386
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Create Desktop Launcher and include sudo password?

    Thanks Tom, but it doesn't seem to work. When I click on the file it asks how it should be run (in terminal etc) but whichever way I try to run it there is a very quick flash on the screen and thats it. Xampp however, is not running.

    Its not a real biggie, but its one of those little niggles that Id really like to get sorted out.

    Any other ideas anyone?

    Cheers

    Max

  5. #5
    Join Date
    Nov 2009
    Beans
    1,203

    Re: Create Desktop Launcher and include sudo password?

    I had a similar question a few days back, and I was able to figure out a solution. Check it out:

    http://ubuntuforums.org/showthread.php?t=1556333

  6. #6
    Join Date
    May 2009
    Location
    Lancaster, PA
    Beans
    1,334
    Distro
    Ubuntu Development Release

    Re: Create Desktop Launcher and include sudo password?

    Quote Originally Posted by inameiname View Post
    I had a similar question a few days back, and I was able to figure out a solution. Check it out:

    http://ubuntuforums.org/showthread.php?t=1556333
    Ah! a cron job! I knew I forgot something.

    Yeah, follow the method that inameiname used, that will get it to work, the only thing is, it could only easily be run on a schedule, not upon command.
    Java Guide Media support Flash x64 Grub2 Get Dropbox! My Look! RSync Twitter

    "Windows 7 was my idea"- I guess Microsoft enjoys copyright infringement?

  7. #7
    Join Date
    Dec 2006
    Beans
    986
    Distro
    Xubuntu 8.04 Hardy Heron

    Re: Create Desktop Launcher and include sudo password?

    Configure your system to open lampp without asking for authentication. Be sure you know exactly why you want to do this. Convenience is not a good reason. Anyway, just edit the file /etc/sudoers. Do it using 'visudo'
    Code:
    sudo visudo
    and append
    Code:
    %usergroup LOCAL=NOPASSWD:/opt/lampp/lampp
    to the file.

    Where %usergroup is the group name of the user(s) who will use lampp without asking for password.

    Look in the manual for sudoers(5) and visudo(8).

    Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way. --Christopher Hitchens

  8. #8
    Join Date
    Dec 2007
    Beans
    386
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Create Desktop Launcher and include sudo password?

    Thanks guys Ill look into that later on.

    Convenience is not a good reason.
    x1a4: Your modified method looks like its the one that will be the best, but why do you say this? The whole point is convenience and I'm the only one with access to the machine. Would this produce any serious kind of security risk? (and if so is it possible to keep the convenient method of starting and stopping Xampp while negating the security risk?)

    Cheers all

    Max

  9. #9
    Join Date
    Oct 2007
    Location
    Europe
    Beans
    3,564
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Create Desktop Launcher and include sudo password?

    you can also start lampp with gksu in your launcher
    Code:
    gksu /opt/lampp/lampp start
    this way you just click the start launcher and type the the password in the gksu dialog box

  10. #10
    Join Date
    Nov 2009
    Beans
    1,203

    Re: Create Desktop Launcher and include sudo password?

    To tom.swartz07, that method I figured out works just fine for me, both on a schedule (have it run at startup through Startup Applications), AND on command, whenever I feel like clicking the desktop launcher. I even have an alias for it in my .bashrc file for whenevever I feel like running it while using the terminal. So if you're having trouble with not being able to run it on command, I'm not sure why. Just remember you have to insert your own username, (not 'me'), in it, which I forgot to put on my post.
    Last edited by inameiname; August 25th, 2010 at 11:03 AM.

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
  •