paramiko
을 사용하여 원격 호스트에 SSH Channel
을 생성합니다. 그러나 ssh_object.exec_command
을 사용하여 명령을 실행하려고하면 명령이 실행되지 않습니다.Python2.7 : ssh.exec_command가 명령을 실행하지 않음
이 기능은 내 ssh
핸들러 작성
def ssh_connect(ip,user,pwd):
'''
This function will make an ssh connection to the ip using the credentials passed and return the handler
Args:
ip: IP Address of the box into which ssh has to be done
user: User name of the box to which ssh has to be done
pass: password of the box to which ssh has to be done
Returns:
An ssh handler
'''
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip, username=user, password=pwd)
return ssh
을 내가 처리기를 사용하고있는 곳은 다음과 같습니다
ssh_obj = ssh_connect(ip, username, password)
folder = "/var/xyz/images/" + build_number
command = "mkdir " + folder
ssh_stdin, ssh_stdout, ssh_stderr = ssh_obj.exec_command(command)
내가 원격 시스템으로 이동, 폴더가 생성 없어했다 . 마찬가지로, ls
명령의 출력도 읽으려고 시도했습니다. ssh_stdout.read()
할 때 응답이 없습니다.
어디로 잘못 가고 있습니까?
ssh_stderr에 로그가 있는지 확인할 수 있습니까? –
@AlekhyaVemavarapu, 어떻게 확인하나요? –
try command = "mkdir -p"+ – skynyrd