Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. ssh to mobile or embedded device using qt program
Forum Update on Monday, May 27th 2025

ssh to mobile or embedded device using qt program

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 2 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lina
    wrote on 23 Feb 2018, 07:38 last edited by
    #1

    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@192.168.1.102:22" ;
    QProcess *process = new QProcess();
    process->start(commands);

    if(!process->waitForStarted()){
        qDebug() << "Could not wait to start...";
    }
    
    if(!process->waitForFinished()) {
        qDebug() << "Could not wait to finish...";
    }
    
    process->closeWriteChannel();
    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?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 23 Feb 2018, 07:44 last edited by
      #2

      Hi,

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      L 2 Replies Last reply 23 Feb 2018, 07:58
      1
      • L Offline
        L Offline
        lina
        wrote on 23 Feb 2018, 07:55 last edited by
        #3

        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.

        1 Reply Last reply
        0
        • S SGaist
          23 Feb 2018, 07:44

          Hi,

          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 ?

          L Offline
          L Offline
          lina
          wrote on 23 Feb 2018, 07:58 last edited by
          #4

          @SGaist

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

          1 Reply Last reply
          0
          • S SGaist
            23 Feb 2018, 07:44

            Hi,

            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 ?

            L Offline
            L Offline
            lina
            wrote on 23 Feb 2018, 08:50 last edited by
            #5

            @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?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 23 Feb 2018, 22:16 last edited by
              #6

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              1/6

              23 Feb 2018, 07:38

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved