[英]I need to write a python script which will make a passwordless connection from one server (server1) to another remote server(server2)
I have successfully created public private keys to make passwordless ssh connection.我已成功创建公共私钥以进行无密码 ssh 连接。 I need to make connection with remote server, go to a particular path, and append some input to sample.log file.
我需要将远程服务器 go 连接到特定路径,并将 append 一些输入连接到 sample.log 文件。 Currently I am using os.system("ssh xxx@aaa.vvv.com") and then the steps to append the input to sample.log file.
目前我正在使用 os.system("ssh xxx@aaa.vvv.com") 然后将 append 的步骤输入到 sample.log 文件。 But my script stops only aftwr making connection with using os.system("ssh xxx@aaa.vvv.com").
但是我的脚本仅在使用 os.system("ssh xxx@aaa.vvv.com") 建立连接后才停止。
Paramiko Module is best suited for it. Paramiko 模块最适合它。
I use it personally to make connections and execute comand from one device to another.我个人使用它来建立连接并从一台设备执行命令到另一台设备。
You can find more detailed information of paramiko on https://www.paramiko.org您可以在https://www.paramiko.org上找到 paramiko 的更多详细信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.