Results 1 to 3 of 3

Thread: How to get root permission inside qt program?

  1. #1
    Join Date
    Jun 2014
    Posts
    24
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default How to get root permission inside qt program?

    I run my QT app without sudo permission but during running phase of the app I need to install the .deb so I am running the command dpkg -i mydeb.deb with qprocess in QT or some other commands which needed to sudo permisssion.

    I do not need the user interaction to enter the password for the same. So how can I do the same in QT app in ubuntu 14.04 ? Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get root permission inside qt program?

    You need to use a mechanism to elevate process permissions. Qt has nothing to offer in this regard, look for platform-dependent solutions (e.g. PolicyKit/PolKit)
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to get root permission inside qt program?

    You could just use QProcess to run exactly the same sudo command as your user would from the command line.

Similar Threads

  1. set ntfs permission
    By bgeller in forum Qt Programming
    Replies: 10
    Last Post: 1st July 2011, 14:59
  2. how to run QT application with root permission
    By noa l in forum Qt Programming
    Replies: 4
    Last Post: 15th December 2010, 14:32
  3. Replies: 7
    Last Post: 19th January 2008, 16:29
  4. Permission denied
    By thomasjoy in forum Qt Programming
    Replies: 1
    Last Post: 17th October 2007, 21:37
  5. Replies: 0
    Last Post: 16th April 2007, 13:18

Tags for this Thread

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.