LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-09-2010, 04:10 AM   #1
hdinn
LQ Newbie
 
Registered: Jul 2009
Posts: 24

Rep: Reputation: 15
Question Problem in launching a terminal command with a Qt Button


hello everybody,

I've created a QT interface with some buttons and labels, and i want to launch a terminal command with one of these buttons,but the command maust starts with "sudo",unfortunately it didn't work because it wants root password and i can't enter it even in the Button cammand....

plz help mz

thnx
 
Old 02-09-2010, 11:18 PM   #2
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,623
Blog Entries: 29

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Did you try asking this question on their mailing list ?

http://lists.trolltech.com/mailman/listinfo/qt-interest
 
Old 02-09-2010, 11:38 PM   #3
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,528

Rep: Reputation: 1218Reputation: 1218Reputation: 1218Reputation: 1218Reputation: 1218Reputation: 1218Reputation: 1218Reputation: 1218Reputation: 1218
You could use one of the gui frontends to sudo. Unfortunately the only ones I know of are:

- gksudo - maybe not good for you since you are using qt, not gtk
- kdesudo - qt, but maybe not good for you since it depends on kde libs

Evo2.
 
Old 02-09-2010, 11:58 PM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
This is not really a QT problem, but how the script that you are trying to run works. Possibly a work around is to write a wrapper script which will receive a password and then call the script that you want to run, avoiding the interactive demands of sudo. If you gave some more information I might be able to give you a better answer. What does the script you want to run do, why do you need to use sudo?
 
Old 02-10-2010, 03:25 AM   #5
hdinn
LQ Newbie
 
Registered: Jul 2009
Posts: 24

Original Poster
Rep: Reputation: 15
Question

Quote:
Originally Posted by graemef View Post
This is not really a QT problem, but how the script that you are trying to run works. Possibly a work around is to write a wrapper script which will receive a password and then call the script that you want to run, avoiding the interactive demands of sudo. If you gave some more information I might be able to give you a better answer. What does the script you want to run do, why do you need to use sudo?


thank you for your reply,actually i want to run an IPTABLES command which needs "sudo" as prefix,in terminal i write
Code:
sudo ./my prog
and the button command runs correctly however without "sudo" when i click on the button it gave me "Permission denied you must be root", and when i write
Code:
sudo iptables ------
in the button code it gave me you didn't write the root password.

i hope you understand now my problem
 
Old 02-10-2010, 07:03 AM   #6
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Flicking through the man pages for sudo. It looks that you can use the -A option to get a GUI to capture and then return the password to sudo, this is not something that I have done the man pages says that you will need to set up the SUDO_ASKPASS setting but that may be worth playing around with.
 
Old 02-10-2010, 09:50 AM   #7
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
Edit /etc/sudoers to contain something like...

Code:
        hdinn    ALL = NOPASSWD: /path/to/myprog
 
  


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
swap button 2 and button 3 in xterm and terminal only? senjak Linux - Software 2 09-27-2009 12:34 AM
How to close terminal window when launching app from command line Casket Linux - Newbie 8 11-02-2007 07:05 AM
Compiling and launching java from the terminal marcoguillen Linux - Software 7 03-25-2007 04:43 AM
Launching a program as root without using the terminal Crushing Belial Linux - Software 2 11-20-2005 11:38 PM
mouse third button scroll problem/ reboot command help madiyaan Linux - Newbie 5 03-16-2005 11:13 AM


All times are GMT -5. The time now is 06:33 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration