paramiko
-
[ Python ] paramiko를 이용한 pem-key SSH 접속 (자동화 작업)AWS Infra 2021. 11. 30. 18:18
key 인증을 이용하여 접속시 parakimo 사용 import paramiko key = paramiko.RSAKey.from_private_key_file("pemfilepath") conn = paramiko.SSHClient() conn.set_missing_host_key_policy(paramiko.AutoAddPolicy()) conn.connect(hostname = " ", username = "", pkey = key ) stdin, stdout, stderr = conn.exec_command('echo "hello"') stdin.close() for line in stdout.read().splitlines(): print(line.decode()) conn.close() ----..