Fabric Keeps Asking For Password
I have fab file which contains env['hosts'] = ['localhost'] env['user'] = 'code' env['password'] = 'searce' def mk_dirtree(): sudo('mkdir %s' % PROJECT_DIR) sudo('chown -R
Solution 1:
If you really want and need to use run()
instead of local()
you can add your SSH public key to the ~/.ssh/authorized_keys
file of your user account.
This would look something like this:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
This solution will circumvent the login password prompt of your local machine. Of course, you'd have to do this for each local machine where you run your fabfile on.
Solution 2:
The run()
and sudo()
operations are carried out via ssh. If you want to run a command on the localhost you should look into using local()
instead:
http://docs.fabfile.org/en/1.4.3/api/core/operations.html?highlight=sudo#fabric.operations.local
On that same page are the docs for run()
and sudo()
which both refer to the fact they run on a "remote host" which infers that they will be run via ssh.
Post a Comment for "Fabric Keeps Asking For Password"