omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Stash, SCP, and ssh-keygen

    Pythonista
    4
    9
    7950
    Loading More Posts
    • 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.
    • ihf
      ihf last edited by

      I would like to use SCP under Stash but it is looking for keys. I know there is an ssh-keygen command but what exactly do I need to do in order to use scp?

      ihf 1 Reply Last reply Reply Quote 0
      • ihf
        ihf @ihf last edited by

        If I try to do:

        scp user@host:/file .

        I get:

        stash:<class 'paramiko.ssh_exception.SSHException'>: No authentication methods available

        Can anyone please help me get this working?

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          It seems to me you need to run ssh-keygen, then copy the resulting key to your host's authorized_keys. @briarfox might have some better advice, as he wrote the module.

          1 Reply Last reply Reply Quote 0
          • ihf
            ihf last edited by ihf

            Perhaps @briarfox can advise but what I did was run ssh-keygen -t rsa which generated a public and private key in the .ssh directory (in the stash-master directory). I then copied the .pub key to my mac (into the /Users/userid/.ssh directory). If I then try to run ssh to userid@macaddr I get "looking for SSH keys...No SSH key found///Auth Error Connection failed. Where did I go wrong?

            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              One thing I found was that the try/except near the connect catches all error, not just auth errors, and reports as no ssh key found.

              Also, Try using dsa, rather than rsa. You could also try moving the keys to ~/.ssh, as paramiko does fallback to that folder.

              1 Reply Last reply Reply Quote 0
              • ihf
                ihf last edited by

                @JonB I created dsa keys and I moved the keys to ~/.ssh (on iPad). No luck. I get:

                Connecting...
                Looking fro SSH keys...
                No SSH key found. Trying password...
                No handlers could be found for logger "paramiko.transport"
                Auth Error
                Conection failed

                1 Reply Last reply Reply Quote 0
                • ywangd
                  ywangd last edited by

                  @briarfox is the author of the ssh tools. So I'll just try answer this as best as I can.

                  • The ssh key files should be generated inside the stash installation root, i.e. $STASH_ROOT/.ssh/

                  • ssh.py can take password from command line while scp can only rely on key files. I have now modified scp to ask for password if key files cannot be found. The changes are now pushed to the dev branch.

                  • However both ssh and scp still failed to connect. ssh-keygen also failed to generate key files. I am not exactly what went wrong. They use to work for Pythonista 1.5. But I have not used them extensively. So I don't know when exactly they stopped working.

                  I'll look into it further when time permits and hopefully @briarfox can shed more light on it.

                  1 Reply Last reply Reply Quote 0
                  • ovrCaffeinatd
                    ovrCaffeinatd last edited by

                    ssh -vvv for verbose logging - also, keep in mind ssh is very picky about file and directory modes when choosing authentication methods.
                    .ssh: 700
                    private key: 600
                    public key: 644

                    1 Reply Last reply Reply Quote 0
                    • ywangd
                      ywangd last edited by

                      @ihf I fixed the bugs with ssh and scp in the latest push. You can get them with just selfupdate.

                      You can use scp like the follows:

                      scp LOCAL_FILE   USER@REMOTE_HOST:/PATH
                      

                      If no SSH key is found, it will prompt for password.

                      The first time you run scp or ssh, it will install the latest paramiko module and ask for Pythonista restart. It will work normally afterwards.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Powered by NodeBB Forums | Contributors