4 ms·
try asking "how can I automate ssh authentication by password?" sometime. I've still never found an answer other than "never do that, here's how to use ssh-agen
by leetcrew 7y ago
try asking "how can I automate ssh authentication by password?" sometime. I've still never found an answer other than "never do that, here's how to use ssh-agent."
- detaro 7y agoThere's actually a pretty good Stackoverflow answer to this one: https://stackoverflow.com/a/43526842 https://stackoverflow.com/a/43526842 (Which I think is a good pattern: sure, mention the "you probably should consider Y", but show the alternatives as well)
- marcosdumay 7y agoAnd the person's comment after the answer gives him 7 different options (6 since the very start) is "no, I can't use option #1". That's unsettling.
- detaro 7y agoI read the response as "I can't use any of these" - which again leads us to them not asking the "right" question.
- marcosdumay 7y agoThey want to do easily something that is hard. I can understand their revolt because it shouldn't be hard, but it is. The easiest way out is probably #1, what probably will need the cooperation of some uncooperative 3rd party. It's the correct question, it's just that the answer sucks.
- rocqua 7y agoHonestly, I hope am answer to that question is never posted on stack overflow. As for an answer, i think something like cat passwd.txt - | ssh Might work. Didn't test it though. The cat outputs all arguments in order, and - is stdin.
- marcosdumay 7y agoThis one doesn't work.
- rocqua 7y agoWhy not?
- clarry 7y agossh probably doesn't read the password from stdin.
- buckminster 7y agoThis is also a really annoying habit: giving a crap answer and then demanding an explanation of how it fails. The meta-answer: if it was this easy people wouldn't keep asking about it. For decades now! When I tried it fifteen years ago ssh insisted on reading the password from keyboard input, not stdin.
- rkeene2 7y ago> Why not? SSH reads the password from the terminal, otherwise it couldn't read the password on a piped input
- LeoPanthera 7y agossh doesn't accept the password from stdin. Don't just guess if you don't know. That's worse than not helping at all.
- peteradio 7y agopexpect
- fiddlerwoaroof 7y agoOr just expect, which might be more likely to be available. Also, there’s sshpass
- Shoop 7y agosshpass works nicely.
- rkeene2 7y agoThere's a program called "sshpass" to do this.
- PascLeRasc 7y agoThere's another anti-pattern that I can't recall the name of, where instead of asking if something can do something, you make the claim that it can't, and let them refute you. It's excellent for something people get very defensive over, like Unix.
- leetcrew 7y agoit seems that I just (unintentionally) did exactly that. I guess my Google skills sucked four years ago.
- koala_man 7y agoWhen I tried googling your exact question, the first hit (https://serverfault.com/a/512220 https://serverfault.com/a/512220) was a SE post where the highest voted (though not accepted) answer was doing exactly that with `sshpass` Tbqh, without you explicitly stating that you're aware of key pairs and concluded that storing plaintext passwords is the best solution for you, I would excuse anyone who thought that you maybe just hadn't done the research.