Results 1 to 3 of 3

Thread: Run sudo comand with QProcess, how to handle password prompt?

  1. #1
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Run sudo comand with QProcess, how to handle password prompt?

    I want to execute a sudo command with QProcess on a GUI Application.

    My question is: How to handle the password prompt to help user enter a password on a dialog?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Run sudo comand with QProcess, how to handle password prompt?

    A better plan would be to use polkit-qt, which is a Qt wrapper around polkit.

    If your using KDE or Gnome, then these frameworks use polkit already; something like KAuth should work well.

  3. #3
    Join Date
    Jul 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Run sudo comand with QProcess, how to handle password prompt?

    An other solution is to use a kdesudo (in KDE) or gksudo (in Gnome) command instead of a sudo command within the QProcess statement. A new window will be opened and ask to the root password.

Similar Threads

  1. QT Never used! GUI and Comand line Program
    By kurt-hardy in forum Newbie
    Replies: 2
    Last Post: 2nd September 2010, 14:10
  2. QProcess::start() failed when application runs from sudo
    By alenyashka in forum Qt Programming
    Replies: 3
    Last Post: 22nd June 2010, 06:35
  3. QProcess: how to run shell script with password?
    By cutie.monkey in forum Qt Programming
    Replies: 0
    Last Post: 23rd March 2010, 05:43
  4. QProcess use dos comand
    By damonlin in forum Qt Programming
    Replies: 4
    Last Post: 26th October 2008, 12:30
  5. Portable Console Password Prompt
    By vermarajeev in forum General Programming
    Replies: 2
    Last Post: 2nd March 2007, 23:29

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.