Important: Please read the Qt Code of Conduct -

How to accept dynamic inputs in qt..?

  • Hi in Linux if we give command SU it asks for password and if we enter right password it login's to super user,in the similar fashion how can i do this through Qt application

    What classes to be used,is it possible to do so ..?

  • Lifetime Qt Champion

    Normally the app will ask user to do so.
    No one will input their root password to an app.
    so the normal use case would to ask user to run the app as
    sudo <appname>

  • @mrjj

    I think you have not understood my question

    #include "widget.h"
    #include "ui_widget.h"
    Widget::Widget(QWidget *parent) :
        ui(new Ui::Widget)
        delete ui;
    void Widget::on_pushButton_clicked()
        ui->lineEdit->setPlaceholderText("Enter Password");

    How can i pass the user entered password or where should i send the password to successfully login to super user..?

    I hope you have understood now

  • Lifetime Qt Champion

    Ok. I dont know how you call su from inside program.
    Its not how it normally work.

    But you can use sudo if added to /etc/sudoers

    Alternatively find out to call the linux api for su.

Log in to reply