You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I have a use case for sshpass where I need to accomplish a file transfer between two remote systems using SCP. There are many people attempting to do this exact thing, and running into the same issue. Lots of duplicate questions on StackOverflow for example. Of course everyone's "solution" is to just use public key authentication, or some misdirection about how the -p parameter is dangerous, which totally misses the point of why one may be using sshpass in the first place.
I realize I could do this as 2 steps, which would be fine for a single operation, but in my case this is part of a much larger script that does this many times for many files.
An example scenario, doing things fully manual/interactive on the CLI:
So baseline is (# of SCPs * 2) prompts. I am running this in a script, which is prompting the user for the password (and storing it "safely" in a file with appropriately locked down permissions, and only for the duration of the script). We'll call file that "pw" for this example. Currently sshpass exits after the first prompt, thus I still get the 2nd prompt in each operation:
user@hostA$ myscript.sh
Enter common password:
user@hostC's password:
foo 100% 4 6.5KB/s 00:00
user@hostC's password:
bar 100% 4 6.5KB/s 00:00
user@hostA$
So now I have to type it (# of SCPs + 1) times, an improvement, but still sort of defeats the purpose of why I am using sshpass here.
So the feature I am requesting is one of these...
a) Automagically provide the password as many times as needed (maybe a param to enable this mode?)
b) Provide a parameter to specify the # of times to provide a password before exit in case it cannot be determined by sshpass
c) Allow specifying multiple passwords to provide (e.g. repeated [-f|-d|-p|-e], used up in order given)
Option c might be the most intuitive & flexible way to go about this.
The text was updated successfully, but these errors were encountered:
So I have a use case for sshpass where I need to accomplish a file transfer between two remote systems using SCP. There are many people attempting to do this exact thing, and running into the same issue. Lots of duplicate questions on StackOverflow for example. Of course everyone's "solution" is to just use public key authentication, or some misdirection about how the -p parameter is dangerous, which totally misses the point of why one may be using sshpass in the first place.
I realize I could do this as 2 steps, which would be fine for a single operation, but in my case this is part of a much larger script that does this many times for many files.
An example scenario, doing things fully manual/interactive on the CLI:
user@hostA$ scp hostB:foo hostC:foo
user@hostB's password:
user@hostC's password:
foo 100% 4 6.5KB/s 00:00
user@hostA$ scp hostB:bar hostC:bar
user@hostB's password:
user@hostC's password:
bar 100% 4 6.5KB/s 00:00
user@hostA$
So baseline is (# of SCPs * 2) prompts. I am running this in a script, which is prompting the user for the password (and storing it "safely" in a file with appropriately locked down permissions, and only for the duration of the script). We'll call file that "pw" for this example. Currently sshpass exits after the first prompt, thus I still get the 2nd prompt in each operation:
user@hostA$ myscript.sh
Enter common password:
user@hostC's password:
foo 100% 4 6.5KB/s 00:00
user@hostC's password:
bar 100% 4 6.5KB/s 00:00
user@hostA$
So now I have to type it (# of SCPs + 1) times, an improvement, but still sort of defeats the purpose of why I am using sshpass here.
So the feature I am requesting is one of these...
a) Automagically provide the password as many times as needed (maybe a param to enable this mode?)
b) Provide a parameter to specify the # of times to provide a password before exit in case it cannot be determined by sshpass
c) Allow specifying multiple passwords to provide (e.g. repeated [-f|-d|-p|-e], used up in order given)
Option c might be the most intuitive & flexible way to go about this.
The text was updated successfully, but these errors were encountered: