We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4395b3a commit 7f517b9Copy full SHA for 7f517b9
day-042/paramiko_cmd.py
@@ -0,0 +1,11 @@
1
+import paramiko
2
+
3
4
+ssh = paramiko.SSHClient()
5
+ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
6
+ssh.connect("IP","端口号","用户名", "密码")
7
+# # 执行命令
8
+catin, catout,caterr = ssh.exec_command('cd data;cat paramiko.txt')
9
+# # 结果放到stdout中,如果有错误将放到stderr中
10
+print(catout.read().decode('utf-8'))
11
+ssh.close()
0 commit comments