3 ms·
> I have to admit I have no clue how to do that, any pointers? My code is poorly documented and badly written, but it works at least the ssh_copy_id one I use
by gopalv 6y ago
> I have to admit I have no clue how to do that, any pointers?
My code is poorly documented and badly written, but it works at least the ssh_copy_id one I use enough to keep updated[1] (that ssh logins with passwords to place the ssh keys).
That's my script, the brains of it is basically an ssh connector.
Paramiko is as simple as
s = SSHClient()
s.connect(hostname=h[1], username=h[0], password=pwd)
(_in, _out, _err) = s.exec_command( cmd, bufsize=4096)
Originally, I had awk scripts to process ^A separated, I'd read the out stream back and formulate my next script over the logs to drill-down in a loop.
[1] - https://github.com/t3rmin4t0r/batchman/blob/master/ssh_copy_id.py https://github.com/t3rmin4t0r/batchman/blob/master/ssh_copy_...