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

ssh to mobile or embedded device using qt program

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 2 Posters 2.3k Views 1 Watching
  • 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.
  • linaL Offline
    linaL Offline
    lina
    wrote on 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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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

      linaL 2 Replies Last reply
      1
      • linaL Offline
        linaL Offline
        lina
        wrote on 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
        • SGaistS SGaist

          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 ?

          linaL Offline
          linaL Offline
          lina
          wrote on 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
          • SGaistS SGaist

            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 ?

            linaL Offline
            linaL Offline
            lina
            wrote on 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
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 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

              • Login

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