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.
Forum Update on Monday, May 27th 2025

How to Block SSH password Dialog.

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 4.0k 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.
  • M Offline
    M Offline
    moyin
    wrote on 22 Nov 2017, 06:24 last edited by
    #1

    As i'm trying to transfer a file to the target from my GUI. i'm making use of SCP in backEnd, once i try to run a dialog coming up with asking password for authentication which is not designed by me. i don't know where its coming from?
    i want to have my own designed password dialog. is there any way to block that default dialog?

    J 1 Reply Last reply 22 Nov 2017, 06:49
    0
    • M moyin
      22 Nov 2017, 06:24

      As i'm trying to transfer a file to the target from my GUI. i'm making use of SCP in backEnd, once i try to run a dialog coming up with asking password for authentication which is not designed by me. i don't know where its coming from?
      i want to have my own designed password dialog. is there any way to block that default dialog?

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 22 Nov 2017, 06:49 last edited by
      #2

      @moyin scp itself is a command line tool and does not show any dialogs. Can you describe more precise what you are doing? On what OS?
      "i'm making use of SCP in backEnd" - how?
      "once i try to run" - what?

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

      M 1 Reply Last reply 22 Nov 2017, 07:37
      2
      • J jsulm
        22 Nov 2017, 06:49

        @moyin scp itself is a command line tool and does not show any dialogs. Can you describe more precise what you are doing? On what OS?
        "i'm making use of SCP in backEnd" - how?
        "once i try to run" - what?

        M Offline
        M Offline
        moyin
        wrote on 22 Nov 2017, 07:37 last edited by
        #3

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

        J J 3 Replies Last reply 22 Nov 2017, 07:54
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 22 Nov 2017, 07:48 last edited by
          #4

          Hi,

          What Linux distribution ?

          Can you describe or show an image of that dialog ? It could very well be the unlocking of your session password storage.

          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
          • M moyin
            22 Nov 2017, 07:37

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

            J Online
            J Online
            jsulm
            Lifetime Qt Champion
            wrote on 22 Nov 2017, 07:54 last edited by
            #5

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

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

            M 1 Reply Last reply 22 Nov 2017, 09:17
            0
            • M moyin
              22 Nov 2017, 07:37

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

              J Online
              J Online
              jsulm
              Lifetime Qt Champion
              wrote on 22 Nov 2017, 07:57 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
                22 Nov 2017, 07:37

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

                J Offline
                J Offline
                JonB
                wrote on 22 Nov 2017, 08:34 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.

                J 1 Reply Last reply 22 Nov 2017, 08:37
                0
                • J JonB
                  22 Nov 2017, 08:34

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

                  J Online
                  J Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on 22 Nov 2017, 08:37 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

                  J 1 Reply Last reply 22 Nov 2017, 08:43
                  0
                  • J jsulm
                    22 Nov 2017, 08:37

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

                    J Offline
                    J Offline
                    JonB
                    wrote on 22 Nov 2017, 08:43 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
                    • J jsulm
                      22 Nov 2017, 07:54

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

                      M Offline
                      M Offline
                      moyin
                      wrote on 22 Nov 2017, 09:17 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) ;
                      
                      }
                      
                      J 1 Reply Last reply 22 Nov 2017, 09:42
                      0
                      • M moyin
                        22 Nov 2017, 09:17

                        @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) ;
                        
                        }
                        
                        J Offline
                        J Offline
                        JonB
                        wrote on 22 Nov 2017, 09:42 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 22 Nov 2017, 09:45
                        0
                        • J JonB
                          22 Nov 2017, 09:42

                          @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 22 Nov 2017, 09:45 last edited by
                          #12

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

                          J J 2 Replies Last reply 22 Nov 2017, 10:03
                          0
                          • M moyin
                            22 Nov 2017, 09:45

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

                            J Online
                            J Online
                            jsulm
                            Lifetime Qt Champion
                            wrote on 22 Nov 2017, 10:03 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
                              22 Nov 2017, 09:45

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

                              J Offline
                              J Offline
                              JonB
                              wrote on 22 Nov 2017, 10:15 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 23 Nov 2017, 09:18 last edited by
                                #15

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

                                1 Reply Last reply
                                0

                                1/15

                                22 Nov 2017, 06:24

                                • Login

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