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
-
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?
-
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?
-
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.
-
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?
-
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.
-
@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 -
@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 whilescp
can only rely on key files. I have now modifiedscp
to ask for password if key files cannot be found. The changes are now pushed to thedev
branch. -
However both
ssh
andscp
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.
-
-
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 -
@ihf I fixed the bugs with
ssh
andscp
in the latest push. You can get them with justselfupdate
.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
orssh
, it will install the latest paramiko module and ask for Pythonista restart. It will work normally afterwards.