ansible paramiko fails with failed to open a SFTP connection (Channel closed.)

Hi All

I am trying to connect to some freebsd server with custom password prompt. So I need to use paramiko since sshpass hangs on custom password prompt.

With -c paramiko now I get the following error…

$ ansible -vvvv -m ping -c paramiko remote
ESTABLISH CONNECTION FOR USER: root on PORT 22 TO remote
REMOTE_MODULE ping
EXEC /bin/sh -c ‘mkdir -p /export/home/axisys/.ansible/tmp/ansible-tmp-1441304559.02-141114907172308 && chmod a+rx /export/home/axisys/.ansible/tmp/ansible-tmp-1441304559.02-141114907172308 && echo /export/home/axisys/.ansible/tmp/ansible-tmp-1441304559.02-141114907172308’
PUT /tmp/tmpPcx8Lk TO /export/home/axisys/.ansible/tmp/ansible-tmp-1441304559.02-141114907172308/ping
remote | FAILED => failed to open a SFTP connection (Channel closed.)

Any suggestion on how to get a workaround.

Thanks

Still looking for some help … I still cannot connect to these freebsd servers

Looks like a pull request is pending to make scp default for paramiko instead of sftp

https://groups.google.com/forum/#topic/ansible-project/pjFYB8tBGgE

Any suggestion how to make scp default for paramiko? I am using ansible 1.7.1

Paramiko does not support SCP to my knowledge, only SFTP. To use SCP you need to use the ssh transport and set scp_if_ssh.

It sounds to me like you have a busted SFTP configuration. You might try using SFTP manually to see what happens.

Paramiko does not support SCP to my knowledge, only SFTP. To use SCP you need to use the ssh transport and set scp_if_ssh.

I cannot use ssh since sshpass hangs on these freebsd custom prompts

I see some discussion on adding scp.py into paramiko

It sounds to me like you have a busted SFTP configuration. You might try using SFTP manually to see what happens.

sftp is not allowed on most of these freebsd systems

Then it sounds like you know exactly what the problem is.

Then it sounds like you know exactly what the problem is.

While waiting on that looks like updating the pam config for pam_unix.so fixes the sshpass hangs
as explained here

https://forums.freebsd.org/threads/sshd-custom-password-prompt.38184/

auth required pam_unix.so no_warn try_first_pass authtok_prompt=Password: