Re: [Sshpass-devel] Option for reading from arbitrary environment variable
Brought to you by:
thesun
From: Chris B. <chr...@gm...> - 2021-07-12 14:51:25
|
My initial use case was rsync proxyjumping through another server, both of which need passwords (in my case, the gateway disallows key logins and doesn't pass keys over to the next server). It was convenient to load the password(s) from a .env file rather than typing them myself and having them in the shell history. On Mon, 12 Jul 2021, 15:44 Shachar Shemesh, <sh...@sh...> wrote: > > On 08/06/2021 12:56, Chris Barnes wrote: > > Hi, > > There have been some situations where I've needed to invoke sshpass a > couple of times in a particular environment. The -f option reasonably > allows you to read from an arbitrary file, rather than saying "this will > always read from the file ~/.sshpass": I felt the same advantage could be > derived from an option to allow you to read from an arbitary environment > variable rather than one with a fixed name. > > There is a patch on sourceforge implementing this as a -E option: > https://sourceforge.net/p/sshpass/patches/14/ > > I am not really familiar with sourceforge, svn, C, or roff, so I'm happy > to receive feedback. > > Thanks > Chris > > Hello Chris, > > Can you explain why setting an environment variable per-invocation doesn't > solve your use case? Under bourne shell and derivatives, you can just do: > > SSHPASS=foo sshpass ssh user1@somewhere ls -la > > SSHPASS=bar sshpass ssh user2@somewhere rm -rf / > > > Does that not solve your use case? > > Thank you, > > Shachar > |