Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to Block SSH password Dialog.

How to Block SSH password Dialog.

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 4.2k 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.
  • M moyin

    @jsulm on pushbutton clicked event i'm running SCP ,so i'm getting
    password dialog that is may be from linux. i don't want to rely on that so i want to hav my own password dialog for my GUI.
    -or is there any other command instead of SCP that accepts password also as input parameter at a time?

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #6

    @moyin You can avoid using passwords if you use public key authentication, see: https://kb.iu.edu/d/aews

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    2
    • M moyin

      @jsulm on pushbutton clicked event i'm running SCP ,so i'm getting
      password dialog that is may be from linux. i don't want to rely on that so i want to hav my own password dialog for my GUI.
      -or is there any other command instead of SCP that accepts password also as input parameter at a time?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #7

      @moyin
      I believe you can -B on the command-line to scp to prevent it prompting for a password. (It's worth a try just to see if the dialog goes away.) You will of course then get an error about "no password" instead. As @jsulm says, you could use public key auth instead. But scp does not allow password on command-line.

      For an alternative to scp, https://stackoverflow.com/a/47328516/489865 says curl does accept a command-line password.

      jsulmJ 1 Reply Last reply
      0
      • JonBJ JonB

        @moyin
        I believe you can -B on the command-line to scp to prevent it prompting for a password. (It's worth a try just to see if the dialog goes away.) You will of course then get an error about "no password" instead. As @jsulm says, you could use public key auth instead. But scp does not allow password on command-line.

        For an alternative to scp, https://stackoverflow.com/a/47328516/489865 says curl does accept a command-line password.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #8

        @JNBarchan I'm wondering what password dialog is shown as scp is a pure command line tool and does not show any dialogs.
        I'm still waiting for more information on how exactly @moyin starts scp.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        JonBJ 1 Reply Last reply
        0
        • jsulmJ jsulm

          @JNBarchan I'm wondering what password dialog is shown as scp is a pure command line tool and does not show any dialogs.
          I'm still waiting for more information on how exactly @moyin starts scp.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #9

          @jsulm
          I agree, but whatever the case if OP is not going to use key-gen and wants to supply password via command-line he's going to be stymied with scp.

          I have no idea whether there is any relation here, but I have a "password prompting dialog" that I don't understand where it's coming from under Ubuntu: when I go into MySQL Workbench first time in a session, it always says "my password has not been saved in the keyring and I need to enter it". It does not look like the dialog is coming from Workbench, more like it's coming from "Ubuntu/the desktop". Dunno if that could be related to his scp, or whether this only comes out of Workbench...

          1 Reply Last reply
          0
          • jsulmJ jsulm

            @moyin How do you start scp? Using QProcess? Can you show the code?

            M Offline
            M Offline
            moyin
            wrote on last edited by
            #10

            @jsulm
            How do you start scp? Using QProcess? Can you show the code?
            yeh! i'm using QProc, Here is my code

            
            void Transfer::on_pushButton_Go_clicked()
            {
                //proc = new QProcess() ;
                QString command = "scp" ;
                QString ip = ui->lineEdit_IP_Address->text() ;
                QString username = ui->lineEdit_SSH_username->text() ;
                QString dest_path = ui->lineEdit_TransferToTarget_DestinationFolder->text() ;
                QString source_path = ui->lineEdit_TransferToTarget_SourcePath->text() ;
                std::stringstream s ;
                s << username.toStdString() << "@" << ip.toStdString() << ":" << dest_path.toStdString();
                std::cout << s.str() << std::endl ;
                QStringList params ;
                params.append(source_path) ;
                params.append(QString::fromStdString(s.str())) ;
                qDebug() << params ;
                //    params.append("/home/span51/Desktop/readme.txt");
                //    params.append("spanidea@192.168.1.26:/home/spanidea/test" );
                qDebug() << connect(&proc, SIGNAL(readyReadStandardError()), this, SLOT(readOutput()));
                qDebug() << connect(&proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readOutput()));
                //    connect(&proc, SIGNAL(errorOccurred(QProcess::ProcessError error)), this, SLOT(readErr()));
                proc.start(command,params) ;
            
            }
            
            JonBJ 1 Reply Last reply
            0
            • M moyin

              @jsulm
              How do you start scp? Using QProcess? Can you show the code?
              yeh! i'm using QProc, Here is my code

              
              void Transfer::on_pushButton_Go_clicked()
              {
                  //proc = new QProcess() ;
                  QString command = "scp" ;
                  QString ip = ui->lineEdit_IP_Address->text() ;
                  QString username = ui->lineEdit_SSH_username->text() ;
                  QString dest_path = ui->lineEdit_TransferToTarget_DestinationFolder->text() ;
                  QString source_path = ui->lineEdit_TransferToTarget_SourcePath->text() ;
                  std::stringstream s ;
                  s << username.toStdString() << "@" << ip.toStdString() << ":" << dest_path.toStdString();
                  std::cout << s.str() << std::endl ;
                  QStringList params ;
                  params.append(source_path) ;
                  params.append(QString::fromStdString(s.str())) ;
                  qDebug() << params ;
                  //    params.append("/home/span51/Desktop/readme.txt");
                  //    params.append("spanidea@192.168.1.26:/home/spanidea/test" );
                  qDebug() << connect(&proc, SIGNAL(readyReadStandardError()), this, SLOT(readOutput()));
                  qDebug() << connect(&proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readOutput()));
                  //    connect(&proc, SIGNAL(errorOccurred(QProcess::ProcessError error)), this, SLOT(readErr()));
                  proc.start(command,params) ;
              
              }
              
              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #11

              @moyin
              Since as we've said scp will not accept a command-line argument for a password, what would you like to do about it in that light?

              M 1 Reply Last reply
              0
              • JonBJ JonB

                @moyin
                Since as we've said scp will not accept a command-line argument for a password, what would you like to do about it in that light?

                M Offline
                M Offline
                moyin
                wrote on last edited by
                #12

                @JNBarchan is there any file_transfer command that accepts password as parameter.

                jsulmJ JonBJ 2 Replies Last reply
                0
                • M moyin

                  @JNBarchan is there any file_transfer command that accepts password as parameter.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  @moyin Isn't public key authentication an alternative?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • M moyin

                    @JNBarchan is there any file_transfer command that accepts password as parameter.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #14

                    @moyin said in How to Block SSH password Dialog.:

                    @JNBarchan is there any file_transfer command that accepts password as parameter.

                    But I answered exactly this in my reply to you. Why do you think I wrote:

                    For an alternative to scp, https://stackoverflow.com/a/47328516/489865 says curl does accept a command-line password.

                    ?

                    Or your alternative is @jsulm's public key for scp, as we have said.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      moyin
                      wrote on last edited by
                      #15

                      how about sshpass?
                      this will accept the password as argument along with username,ip,etc..,

                      1 Reply Last reply
                      0

                      • Login

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