Important: Please read the Qt Code of Conduct -

ssh to mobile or embedded device using qt program

  • Hi,
    I want to establish a connection with my android phone using Qprocess through ssh connection. I run sshDroid on my phone and I wrote the following code in qt to establish the ssh connection:
    QString commands = "ssh root@" ;
    QProcess *process = new QProcess();

        qDebug() << "Could not wait to start...";
    if(!process->waitForFinished()) {
        qDebug() << "Could not wait to finish...";
    qDebug() << process->readAll();

    I always get this response in my output window:
    Could not wait to start...
    Could not wait to finish...
    Do you have any idea to establish the connection?

  • Lifetime Qt Champion


    From where are you trying to establish the connection ? From your desktop ? If so, do you have the ssh client application installed ?

    What OS are you running on ?
    What version of Qt ?

  • Hi SGaist,
    yes it's a desktop application. No I didn't install ssh client. now it is on qt5.8.0 on win7 but I want to compile it with qtAndroid in the next step.

  • @SGaist

    I am confused with ssh client, I thought that my program is a ssh client, isn't it?

  • @SGaist

    Thanks, I install ssh client and connect through it from my program. how can I give user and password of the remote device after the primary connection using qprocess?

  • Lifetime Qt Champion

    I just remembered something: ssh doesn't take a password from stdin so you can't do it with QProcess.

    You should take a look at his stackoverflow post which provides several possibilities.

Log in to reply