Closed saspyrate closed 2 years ago
So, I've looked into this sshpass and it does seem to work, from my linux system at least (it doesn't exist on my pc). You mention 'other stuff'; are there other things really or just this sshpass command? I don't think just any arbitrary command and options is a good way to go on this. Just anything won't really work, but this is an ssh specific command to use w/ ssh, so it does make sense. Given that I need to build out the parameters for the fork and exec, just so, in python, I'd prefer a separate key for this, like sshpass
, to augment the ssh
key that will still need to be provided and is still the key that determines the SSH access method.
I've prototyped this using sshpassfor the executable (/usr/bin/sshpass or whatever), and
sshpassparms` for the list of whichever parms you want to use with it; there are several different choices, so a list for those is what I need. So, like this:
sshp = {'saspath': '/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8',
'host': 'tom64-4.unx.sas.com',
'ssh': '/usr/bin/ssh',
'sshpass': '/usr/bin/sshpass',
#'sshpass'parms: ['-f', '/file/with/password'],
'sshpass'parms: ['-p', 'mypassword'],
#'sshpass'parms: ['-e'], # pw is in env var SSHPASS
}
I've pushed this to main, so you can try it out and see if it works for you like expected. Let me know what you think. Tom
Perfect, that lets me do what I was looking for. I just tested it. Thank you for the quick implementation!
You mention 'other stuff'; are there other things really or just this sshpass command?
I've got my own small wrapper script around sshpass
to fetch the password. But I can just pass that and its arguments to the newly introduced options sshpass
and sshpassparms
. So everything's fine.
Cool. And this is actually a nice way to get around having to set up passwordless ssh, especially in a container or other temporary environment. Having the options to provide a pw through automated ways is helpful; and it seems to work right, which is the biggest deal :)
I'm going to close this. I've just built a new version (V4.3.0) which includes this feature, so it's available now here, on Pypi, and soon on Conda (once the bot notices and builds). Tom
It's me again with another (small) feature request. Hope that's alright ;-)
Would it be possible to allow a list in the configuration for the
ssh
option? This would make it possible to usesshpass
and other stuff.Currently, the example configuration looks as follow:
I'd like to be able to change it to the following: