fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] passwordless ssh


From: Periya.Data
Subject: [Fab-user] passwordless ssh
Date: Tue, 14 Feb 2012 09:20:45 -0800

Hi,
    Greetings. I am a beginner to Fabric and liking it. I am trying to login to 3 remote machines and getting their "/etc/*-release". My local machine is a windows machine where I have installed Cygwin and all the fabric related stuff. I have generated ssh key, copied the id-rsa.pub to authorized key and copied them over to the remote machines as well.

Despite doing them, I am unable to connect them without my password. Fabric is asking for logging into a remote machine. What is going wrong? What is the right way to use env.key_filename? Is there anything I have to import? Surprisingly, it asks for my password only once. It is not asking for the subsequent servers? Why? I do not want to do this in the command-line using "- i" option. I want this to be in the fab file itself.

Your help is much appreciated.


A min. working example is here:

=====================================
from fabric.api import *
from fabric.operations import local, put

def dev():
    env.user = 'abcd'
    env.hosts = ['server01', 'server02', 'server03']
    env.key_filename = ['/.ssh/id_rsa.pub']

@serial
def host_info():
    print 'Checking unix release of host: ', env.hosts
    run('cat /etc/*-release')

=================================
execution:

address@hidden /cygdrive/c/SS/backup
$ fab dev host_info -i /.ssh/id_rsa.pub
[sl73caed01] Executing task 'host_info'
Checking unix release of host:  [
'server01', 'server02', 'server03']
[
server01] run: cat /etc/*-release
[
server01] Login password:
[
server01] out: Red Hat Enterprise Linux Server release 5.5 (Tikanga)

[
server02] Executing task 'host_info'
Checking unix release of host:  ['
server01', 'server02', 'server03']
[
server02] run: cat /etc/*-release
[
server02] out: Red Hat Enterprise Linux Server release 5.5 (Tikanga)

[
server03] Executing task 'host_info'
Checking unix release of host:  [
'server01', 'server02', 'server03']
[
server03] run: cat /etc/*-release
[
server03] out: Red Hat Enterprise Linux Server release 5.5 (Tikanga)


Done.
Disconnecting from server01... done.
Disconnecting from server02... done.
Disconnecting from server03... done.

address@hidden /cygdrive/c/SS/backup


reply via email to

[Prev in Thread] Current Thread [Next in Thread]