# How to handle password prompt when doing scp file transfer.

**URL:** <https://forum.ansible.com/t/how-to-handle-password-prompt-when-doing-scp-file-transfer/33022>\
**Category:** Ansible Developer\
**Created:** [May 25, 2020, 4:25pm UTC](https://forum.ansible.com/t/how-to-handle-password-prompt-when-doing-scp-file-transfer/33022 "2020-05-25T16:25:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pushparaj\_Gothandam](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/pushparaj_gothandam/32/5538_2.png) [@Pushparaj\_Gothandam](https://forum.ansible.com/u/Pushparaj_Gothandam)\
**Post date:** [May 25, 2020, 4:25pm UTC](https://forum.ansible.com/t/how-to-handle-password-prompt-when-doing-scp-file-transfer/33022/1 "2020-05-25T16:25:56Z")

</div>

Hi Team,

How to handle password prompt when doing scp file transfer. Actually target scp server is generating banner message along with password prompt. Please help how to resolve the issue.

- name: transfer the image  
ios\_command:  
commands:
- command: ‘copy scp://{{ ansible\_user }}@{{ ip\_address }}/{{ new\_system\_image }} flash:’  
prompt:
- ‘Destination filename [{{ new\_system\_image }}]’
- ‘Password’  
answer:
- “\r”
- “{{ password }}”

---

<div class="post-metadata">

**Author:** ![Jeffrey\_Zhang](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jeffrey\_Zhang](https://forum.ansible.com/u/Jeffrey_Zhang)\
**Post date:** [May 25, 2020, 4:32pm UTC](https://forum.ansible.com/t/how-to-handle-password-prompt-when-doing-scp-file-transfer/33022/2 "2020-05-25T16:32:06Z")

</div>

try `sshpass` ?
