# scp\_if\_ssh not working as intended

**URL:** <https://forum.ansible.com/t/scp-if-ssh-not-working-as-intended/14874>\
**Category:** Ansible Project\
**Created:** [March 27, 2014, 8:20pm UTC](https://forum.ansible.com/t/scp-if-ssh-not-working-as-intended/14874 "2014-03-27T20:20:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc.petrivelli](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/marc.petrivelli/32/3773_2.png) [@marc.petrivelli](https://forum.ansible.com/u/marc.petrivelli)\
**Post date:** [March 27, 2014, 8:20pm UTC](https://forum.ansible.com/t/scp-if-ssh-not-working-as-intended/14874/1 "2014-03-27T20:20:40Z")

</div>

I am trying to run the following playbook to deploy a key to a number of servers

deploy\_key.yml:

> - hosts: servers  
> gather\_facts: no  
> user: root  
> vars:
> - key\_file: /root/.ssh/id\_rsa.pub  
> tasks:
> - name: add authorized keys  
> authorized\_key: user=root  
> key=“{{ item }}”  
> with\_file:
> - “{{ key\_file }}”

in ansible.cfg i added the following line:

> scp\_if\_ssh = True

from the command line I am executing the following command:

> ansible-playbook -k deploy\_key.yml

As expected I am prompted for my password and it seems to authenticate but when the play is run I get the following error:

> fatal: [m-vc] =\> failed to open a SFTP connection (Administratively prohibited)

My understanding was that setting scp\_if\_ssh=True in the ansible.cfg file would force ansible to transfer files using scp instead of sftp. I tried manually transferring a file on the command line using scp and it works fine. Am I missing something here?
