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 .
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:
Looking fro SSH keys...
No SSH key found. Trying password...
No handlers could be found for logger "paramiko.transport"
@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.
ssh.pycan take password from command line while
scpcan only rely on key files. I have now modified
scpto ask for password if key files cannot be found. The changes are now pushed to the
scpstill failed to connect.
ssh-keygenalso 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.
private key: 600
public key: 644
@ihf I fixed the bugs with
scpin the latest push. You can get them with just
You can use
scplike 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
ssh, it will install the latest paramiko module and ask for Pythonista restart. It will work normally afterwards.