# Reverse ssh tunnel

**URL:** <https://forum.ansible.com/t/reverse-ssh-tunnel/13225>\
**Category:** Ansible Project\
**Created:** [July 30, 2013, 8:52pm UTC](https://forum.ansible.com/t/reverse-ssh-tunnel/13225 "2013-07-30T20:52:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oded\_Ovdat](https://avatars.discourse-cdn.com/v4/letter/o/8e7dd6/32.png) [@Oded\_Ovdat](https://forum.ansible.com/u/Oded_Ovdat)\
**Post date:** [July 30, 2013, 8:52pm UTC](https://forum.ansible.com/t/reverse-ssh-tunnel/13225/1 "2013-07-30T20:52:10Z")

</div>

Hi all,  
Im new to ansible, I’ve been trying to remotely run some scripts on my linux server  
my remote srv is connected via reverse SSH tunnel, so to remotely connect to it I run “ssh admin@localhost -p ”  
but I simply can’t connect with to it using ansible  
I added to my inventory (/etc/ansible/hosts) this:

[devices]  
terminal ansible\_ssh\_port=22 ansible\_ssh\_host=127.0.0.1:30002 ansible\_connection=ssh ansible\_ssh\_user=admin

I also tried this:

[devices]  
terminal ansible\_ssh\_port=30002 ansible\_ssh\_host=127.0.0.1 ansible\_connection=ssh ansible\_ssh\_user=admin

maybe there is a configuration or a flag I didn’t use / mark

any idea ?

thanks in advance for any help !

---

<div class="post-metadata">

**Author:** ![Javier\_Candeira](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@Javier\_Candeira](https://forum.ansible.com/u/Javier_Candeira)\
**Post date:** [July 30, 2013, 9:50pm UTC](https://forum.ansible.com/t/reverse-ssh-tunnel/13225/2 "2013-07-30T21:50:01Z")

</div>

I have a couple of servers that I manage via reverse tunnels, and I  
use the second syntax:

> terminal ansible\_ssh\_port=30002 ansible\_ssh\_host=127.0.0.1 ansible\_connection=ssh ansible\_ssh\_user=admin

J
