import paramiko

# private = paramiko.RSAKey.from_private_key()   秘钥

trans = paramiko.Transport(("123.*.*。*",22))
trans.connect(username='root',password='***************')

# 通信
ssh = paramiko.SSHClient()
ssh._transport = trans

# 执行shell命令
stdin, stdout, stderror = ssh.exec_command("ls -la")
print(stdout.read().decode('utf-8'))