0

I am trying to write a fab file which will do the auto deployment of my code on amazon server. So for that I am giving the SSH connection path at the top of the fabric method. But its not connecting and asking for password. I have the .pem file using which I am able to connect successfully from my Ubuntu terminal. But the same thing is not working when I am trying to do through fabric and its asking for password.

Example Code snippet of my fabric file.

from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm

@hosts('-i /path/to/file/project.pem ubuntu@ec2-11-111-1111-11.mm-east-1.compute.amazonaws.com')
def host_type():

    """
    Method used to see the machines OS.
    """

    run('uname -s')

Is there any way to make it password less. Thanks

sandeep
  • 3,061
  • 11
  • 35
  • 54

1 Answers1

0

Set up your public and private keys SSH authentication (the id_rsa and id_rsa.pub files). Check here if you have any problem.

Then, put the id_rsa.pub content into ~/.ssh/authorized_keys of your remote server.

Lastly, configure Fabric to use the key env.key_filename = "~/.ssh/id_rsa"

Edwin Lunando
  • 2,726
  • 3
  • 24
  • 33