Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fabric asks for root password

Tags:

python

fabric

I am using Fabric to run the following:

def staging():
    """ use staging environment on remote host"""
    env.user = 'ubuntu'
    env.environment = 'staging'
    env.hosts = ['host.dev']
    _setup_path()

def bootstrap():
    """ initialize remote host environment (virtualenv, deploy, update) """
    require('root', provided_by=('staging', 'production'))
    run('mkdir -p %(root)s' % env)
    run('mkdir -p %s' % os.path.join(env.home, 'www', 'log'))
    create_virtualenv()
    deploy()
    update_requirements()

But I get this:

[email protected]:~/projects/proj_name$ fab staging bootstrap
[host.dev] run: mkdir -p /home/ubuntu/www/staging
Password for [email protected]: 

Why is Fabric asking for my password? This is the default ubuntu root user which has no password in the sudoers files. What's going on here?

like image 435
Yuval Adam Avatar asked Dec 11 '10 13:12

Yuval Adam


People also ask

What is Fabfile?

This is the file that Fabric uses to execute tasks. Each task is a simple function. The fabfile should be in the same directory where you run the Fabric tool. The fabfile is where all of your functions, roles, configurations, etc. will be defined.


1 Answers

meta: Just realized this question is still unanswered. I have no idea what really happened there but here's a guess.

This was probably caused by failing to use a keyfile when connecting to a machine where plaintext password SSH connection was disabled.

Proper usage would be:

fab -i keyfile.pem <fabric_task>
like image 198
Yuval Adam Avatar answered Oct 15 '22 14:10

Yuval Adam