private = paramiko.RSAKey.from_private_key_file('/home/tqc/.ssh/id_rsa')

    # 实例化SSHClient
    client = paramiko.SSHClient()

    # 自动添加策略,保存服务器的主机名和密钥信息,如果不添加,那么不再本地know_hosts文件中记录的主机将无法连接
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

    # 连接SSH服务端,以用户名和密码进行认证
    client.connect(hostname='47.94.192.51', port=22, username='root', pkey=private)
    _,stdout,stderr=client.exec_command("hostname")
    print(stdout.read().decode("utf-8"))
    client.close()