# How to set \`ssh\_user\` and \`ssh\_key\_file\` in Ansible 2 Python API?

**URL:** <https://forum.ansible.com/t/how-to-set-ssh-user-and-ssh-key-file-in-ansible-2-python-api/22248>\
**Category:** Ansible Project\
**Created:** [August 9, 2016, 6:37pm UTC](https://forum.ansible.com/t/how-to-set-ssh-user-and-ssh-key-file-in-ansible-2-python-api/22248 "2016-08-09T18:37:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil\_Hooey](https://avatars.discourse-cdn.com/v4/letter/n/ee59a6/32.png) [@Neil\_Hooey](https://forum.ansible.com/u/Neil_Hooey)\
**Post date:** [August 9, 2016, 6:37pm UTC](https://forum.ansible.com/t/how-to-set-ssh-user-and-ssh-key-file-in-ansible-2-python-api/22248/1 "2016-08-09T18:37:18Z")

</div>

How do you set `ssh_user` and `ssh_key_file` when making a connection with the Ansible 2 Python API?

Adding `user`, `ssh_user` or `remote_user` to the `options` variable in the code on the [Ansible 2 Python API documentation page](https://docs.ansible.com/ansible/developing_api.html) all fail.

- Neil
