[python] paramiko 활용하여 SSH Client 활용

2018. 5. 15. 15:35 - mr.november11

[paramiko import 시 AttributeError: 'module' object has no attribute 'SSHClient' 에러 발생 시]

>>> import paramiko
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/paramiko.py", line 7, in <module>
AttributeError: 'module' object has no attribute 'SSHClient'
>>>

-> 해당 폴더 내 paramiko.pyc 파일 삭제 하면 정상 


Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
>>>


pakramiko 예제 
#!/bin/env python
#coding=UTF-8

import paramiko


client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

host="<IP>"
port_num = 22
user = "<ID>"
pw = "<PW>"

client.connect(hostname=host, port=port_num, username=user, password=pw)

print client

client.close()



다른 카테고리의 글 목록

Python 카테고리의 포스트를 톺아봅니다