简体   繁体   English

我需要编写一个 python 脚本,它将建立从一台服务器(server1)到另一台远程服务器(server2)的无密码连接

[英]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.

相关问题 我需要将变量从我的 python 脚本传递到远程服务器 - I need to pass variable from my python script to a remote server Python 脚本将文件和目录从一台远程服务器复制到另一台远程服务器 - Python script to copy file and directory from one remote server to another remote server 通过 ssh 使用 python mysqldb 连接器无密码连接到远程 mysql 服务器 - Connection to remote mysql server through ssh using python mysqldb connector passwordless Python PySFTP将文件从一台远程服务器传输到另一台远程服务器 - Python PySFTP transfer files from one remote server to another remote server 如何从远程连接访问python http服务器? - How do I access a python http server from a remote connection? Python脚本将数据从一台MySQL服务器传输到另一台MySQL服务器 - Python script to transfer data from one MySQL server to another one Bash脚本传输到Python-将日志从服务器复制到另一台远程服务器 - Bash script transfer to Python - copy logs from server to another remote server 需要从python服务器运行TCL脚本 - Need to run TCL script from python server 在远程服务器上执行本地python脚本(未安装python) - Executing local python script on remote server(which has no python installed) 如何将参数从服务器上的一个python脚本传递给另一个? - How to pass arguments from one python script on the server to another?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM