Fabric asks for root password

2024/11/16 17:28:39

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?

Answer

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>
https://en.xdnf.cn/q/71644.html

Related Q&A

Beautifulsoup results to pandas dataframe

The below code returns me a table with the following resultsr = requests.get(url) soup = bs4.BeautifulSoup(r.text, lxml)mylist = soup.find(attrs={class: table_grey_border}) print(mylist)results - it st…

XGBoost CV and best iteration

I am using XGBoost cv to find the optimal number of rounds for my model. I would be very grateful if someone could confirm (or refute), the optimal number of rounds is: estop = 40res = xgb.cv(params, d…

Whats the correct way to implement a metaclass with a different signature than `type`?

Say I want to implement a metaclass that should serve as a class factory. But unlike the type constructor, which takes 3 arguments, my metaclass should be callable without any arguments:Cls1 = MyMeta()…

Python -- Regex -- How to find a string between two sets of strings

Consider the following:<div id=hotlinklist><a href="foo1.com">Foo1</a><div id=hotlink><a href="/">Home</a></div><div id=hotlink><a…

Kivy TextInput horizontal and vertical align (centering text)

How to center a text horizontally in a TextInput in Kivy?I have the following screen:But I want to centralize my text like this:And this is part of my kv language:BoxLayout: orientation: verticalLabe…

How to capture python SSL(HTTPS) connection through fiddler2

Im trying to capture python SSL(HTTPS) connections through Fiddler2 local proxy. But I only got an error.codeimport requests requests.get("https://www.python.org", proxies={"http": …

removing leading 0 from matplotlib tick label formatting

How can I change the ticklabels of numeric decimal data (say between 0 and 1) to be "0", ".1", ".2" rather than "0.0", "0.1", "0.2" in matplo…

How do I check if an iterator is actually an iterator container?

I have a dummy example of an iterator container below (the real one reads a file too large to fit in memory):class DummyIterator:def __init__(self, max_value):self.max_value = max_valuedef __iter__(sel…

Python Terminated Thread Cannot Restart

I have a thread that gets executed when some action occurs. Given the logic of the program, the thread cannot possibly be started while another instance of it is still running. Yet when I call it a sec…

TypeError: NoneType object is not subscriptable [duplicate]

This question already has an answer here:mysqldb .. NoneType object is not subscriptable(1 answer)Closed 8 years ago.The error: names = curfetchone()[0]TypeError: NoneType object is not subscriptable. …