[SOLVED] QProcess sudo ls doesn't work.

  • I added this line to sudoers but it doesn't work.

    @metheuser ALL=(ALL) NOPASSWD: /usr/bin/ls@

    then I call this on button press event:
    @process = new QProcess(this);
    process->start( "/usr/bin/sudo /usr/bin/ls");
    process->waitForFinished( -1);@

    it will always fail.

    The only working sudo command is sudo -V

    However, on the konsole "sudo ls" or "/usr/bin/sudo" works fine.

    Please Help.

  • SOLVED: If you're running the most awesomest Linux Distro like Mageia 3 than you need to remove the enforced tty requirement with visudo.
    Comment out a line that says "Defaults requiretty".

    Actually this distro is awesomer than most awesomest.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.