Results 1 to 2 of 2

Thread: Running shell script with as super user in N900

  1. #1
    Join Date
    Oct 2009
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Running shell script with as super user in N900

    Hey,

    I am implementing a little application that needs to run a script that needs root privileges and I am wondering how to do that with QT in Meamo.

    Right now I am using QProcess to run my script.

    proc->start("sh", QStringList() << "script.sh" );

    which is ok for running the script, but obviously it fails to execute and gives an error.

    changing it to proc->start("sh", QStringList() << "sudo script.sh" ); doesn't seem to help either as it doesn't prompt a password for me. Not sure how do that, but is not functionality I am looking for either.

    So any help would be appreciated.

    Cheers,
    Simo

  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: Running shell script with as super user in N900

    In Linux sh scripts can't gain super-user priviledges - I mean the script itself can be ran suid root but each subprogram ran from it will not inherit that priviledge. There is a way around this but I won't suggest it here. I can only say it boils down to using a helper application that will gain the priviledges first, dealing with uid and euid (effective user id) and run the script then. Otherwise your only choice is to run the script from sh that already has superuser access rights but I guess that's not what you want (unless you want to run the whole N900 environment as root).
    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.


Similar Threads

  1. QProcess: how to run shell script with password?
    By cutie.monkey in forum Qt Programming
    Replies: 0
    Last Post: 23rd March 2010, 05:43
  2. setstandardoutputprocess vs piped shell script
    By oji in forum Qt Programming
    Replies: 3
    Last Post: 16th October 2009, 13:16
  3. Call script shell with Qt
    By zeeb100 in forum Qt Programming
    Replies: 6
    Last Post: 26th February 2009, 09:17
  4. How to use shell script files ?
    By npc in forum Newbie
    Replies: 3
    Last Post: 15th February 2007, 08:26
  5. Replies: 1
    Last Post: 17th May 2006, 00:23

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.