Oleksandr Dashkov
Oleksandr Dashkov

Reputation: 2858

How to use Fabric with proxy servers?

I have one server server1. I would like to connect to the server2 via the server1 using Fabric script and run my commands.

I tried to run code like run("ssh server2"):

@task()
deploy():
    with run("ssh server2"):
        # some code here...
        with cd('my directory...'):
            pass

But when I run the task like this I get a console for the input (console of my second server) instead of the execution of the code.

Upvotes: 1

Views: 1160

Answers (1)

9000
9000

Reputation: 40904

Configure the "proxy server", aka "jump host", in your ~/.ssh/config. Make sure it works from command line.

Then use the same in Fabric.

Upvotes: 2

Related Questions