LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-09-2009, 08:30 AM   #1
blurboy
LQ Newbie
 
Registered: Sep 2009
Posts: 8

Rep: Reputation: 0
How can I double click and open application with sudo permission


I have an application that can be opened in Terminal by entering the following command:
sudo ./MyApplication

The Terminal will then prompt me for my sudo password which I will need to enter manually.
And the program will run.

Is there any ways where I can just double click my application icon and run it directly with sudo permissions? Can I set it in the properties to automatically run it with sudo permissions which is something like setting "Run the program as an Administrator"?

Last edited by blurboy; 10-09-2009 at 06:14 PM.
 
Old 10-09-2009, 08:38 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
create a file containing the text:
Code:
sudo MyApplication
give it execute permission and you can double click on it.
 
Old 10-09-2009, 02:30 PM   #3
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by blurboy View Post
I have an application that can be opened in Terminal by entering the following command:
sudo ./MyApplication

The Terminal will then prompt me for my sudo password which I will need to enter manually.
And the program will run.

Is there any ways where I can just double click my application icon and run it directly with sudo permissions? Can I set it in the properties to automatically run it with sudo permissions which is something like setting "Run the program as an Administrator"?
No, to use sudo you must enter a password -- always. And sudo won't allow you to give it a password without user interaction. So the trick is to figure out how to enter a password after clicking a desktop icon.

Here's one way -- put this into a shell script:

Code:
kdesu (program name)
-- or, for Gnome --

Code:
gnomesu (program name)
This will launch a dialog that asks for a password.
 
Old 10-09-2009, 02:50 PM   #4
Widgeteye
Member
 
Registered: Mar 2005
Posts: 130

Rep: Reputation: 17
Quote:
No, to use sudo you must enter a password -- always. And sudo won't allow you to give it a password without user interaction. So the trick is to figure out how to enter a password after clicking a desktop icon.
Wrong.

edit /etc/sudoers and put the following in it:

# User privilege specification
root ALL=(ALL) ALL
yourname ALL=(ALL) NOPASSWD: ALL

Last edited by Widgeteye; 10-09-2009 at 02:52 PM.
 
Old 10-09-2009, 03:51 PM   #5
DarkeKun
LQ Newbie
 
Registered: Oct 2009
Posts: 3

Rep: Reputation: 0
what should I use to edit it with?
 
Old 10-09-2009, 04:28 PM   #6
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,336

Rep: Reputation: 231Reputation: 231Reputation: 231
any text editor ! duh !
 
Old 10-09-2009, 04:42 PM   #7
blurboy
LQ Newbie
 
Registered: Sep 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lutusp View Post
No, to use sudo you must enter a password -- always. And sudo won't allow you to give it a password without user interaction. So the trick is to figure out how to enter a password after clicking a desktop icon.

Here's one way -- put this into a shell script:

Code:
kdesu (program name)
-- or, for Gnome --

Code:
gnomesu (program name)
This will launch a dialog that asks for a password.
this method dont work. it did prompt for a password. but it is the root password. I am using sudo all along.. root is not enable. there is no root password
 
Old 10-09-2009, 05:02 PM   #8
DarkeKun
LQ Newbie
 
Registered: Oct 2009
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by smeezekitty View Post
any text editor ! duh !
Thanks, and sorry because im new to this, but what text editor, i dont know anything here..
 
Old 10-09-2009, 05:09 PM   #9
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,336

Rep: Reputation: 231Reputation: 231Reputation: 231
do you know how confusing it is to help 2 people at once?
i am booting Ubuntu (shutter) now to see what you can use
 
Old 10-09-2009, 05:09 PM   #10
blurboy
LQ Newbie
 
Registered: Sep 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Widgeteye View Post
Wrong.

edit /etc/sudoers and put the following in it:

# User privilege specification
root ALL=(ALL) ALL
yourname ALL=(ALL) NOPASSWD: ALL
follow what you said. edited the file using sudo vi /etc/sudoers

when i type sudo ./MyApplication it still ask me for my password.

what I need is to be able to run MyApplication when I double click the icon and run with sudo permission.
 
Old 10-09-2009, 05:13 PM   #11
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,336

Rep: Reputation: 231Reputation: 231Reputation: 231
ok type sudo gedit at the terminal
 
Old 10-09-2009, 06:13 PM   #12
blurboy
LQ Newbie
 
Registered: Sep 2009
Posts: 8

Original Poster
Rep: Reputation: 0
ok i have solve my problem by creating a shell script file with the command "gksudo MyApplication" inside. By double clicking this file i can run my application with sudo permissions.. it will have a dialog box prompting me to enter the password at least =)
 
Old 10-09-2009, 06:38 PM   #13
Widgeteye
Member
 
Registered: Mar 2005
Posts: 130

Rep: Reputation: 17
OK, you have to edit the file using "visudo" as root.
type visudo sudoers

then make the changes and save. you have to edit with "visudo"

It says right in the file how to edit.
 
Old 10-09-2009, 08:52 PM   #14
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by Widgeteye View Post
Wrong.

edit /etc/sudoers and put the following in it:

# User privilege specification
root ALL=(ALL) ALL
yourname ALL=(ALL) NOPASSWD: ALL
Okay, let me rephrase -- everyone should always enter a password for sudo. To dismantle this protection is utterly brainless.
 
Old 10-09-2009, 08:56 PM   #15
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by blurboy View Post
this method dont work. it did prompt for a password. but it is the root password. I am using sudo all along.. root is not enable. there is no root password
What? Yes, there is a root password, or if not, you need to set one now.

Don't you understand that "sudo" requires the root password, and that when sudo is enabled, you become root?

Logging on as root, and using "sudo", both give you root privileges. The latter is preferred.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Double/single click open files klarsin Linux - Desktop 2 02-16-2008 04:32 PM
How to set double click to open video in full screen in mplayer ankur_linuxfan Linux - Software 1 05-14-2005 04:33 AM
How can I open WMV files by Double Click? WhiteTree Linux - Software 4 03-26-2005 05:52 PM
Problem haveing xine open a media file when I double click on it. oryan_dunn Linux - Software 12 09-02-2004 06:45 AM
Howto open files w/ double-click, not one? in Konqueror Steel Shepherd Linux - Newbie 3 02-19-2004 05:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration