#!/usr/bin/python
import paramiko
host='192.168.4.101'
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username='root', password='redhat')
stdin, stdout, stderr = ssh.exec_command('ls /')
ssh.exec_command('touch /hcy.txt')
转载于:https://www.cnblogs.com/yunsshcy/p/8632943.html