python - Python2.7: ssh.exec_command works on Ubuntu not on FreeBSD -
i'm creating ssh channel
remote host using paramiko
. however, when try execute command using ssh_object.exec_command
, command doesn't seem executed on freebsd boxes, works on ubuntu boxes. there permission issue or prerequisite need check in remote machines?
this function creates ssh
handler:
def ssh_connect(ip,user,pwd): ''' function make ssh connection ip using credentials passed , return handler args: ip: ip address of box ssh has done user: user name of box ssh has done pass: password of box ssh has done returns: ssh handler ''' ssh = paramiko.sshclient() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh.connect(ip, username=user, password=pwd) return ssh
and i'm using handler:
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)
when go remote machine, folder has not got created. similarly, tried reading output of ls
command well. no response arrives when ssh_stdout.read()
.
there's not response when run ssh_stderr.read()
either.
the strace
of process id stuck here:
root@ubuntu:~# strace -p 2368 process 2368 attached futex(0xef1e20, futex_wait_private, 0, null
where going wrong?
Comments
Post a Comment