I would like to open a cmd and log in a computer by ssh
import os os.system('cmd /c "plink -batch -ssh root@host -pw password"')
after this i want to interact with that cmd (kind of echo things in it) so, after ssh give it "telnet" command and enter, after username, and pw
i have already tried subprocess.Popen
but i cant solve to give a command and wait, and give the next command, and telnet does not support to give password in cmd
If any other solution is suaitable, its okay for me, im just trying to solve it this way
Thanks for anwers in advance!
Instead of using subprocess to ssh into a machine use paramiko . It's better and more secure. Have a look at this paramiko tutorial
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.