Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run a Fabric arbitrary sudo command without having to type password?

Tags:

python

fabric

With Fabric, according to this documentation, you can run an arbitrary shell command without having a fabfile like this:

fab -H host1,host2 -- echo 'hello, world!'

You can also run sudo commands in the same way, but you will be prompted for the sudo password for every host in the list.

Is there a way to avoid having to type the sudo password for each host, must like the Fabric function sudo() works?

like image 460
Neil Avatar asked Nov 08 '12 19:11

Neil


1 Answers

just add the following line to etc/sudoers where myusername should be the intended user who will run sudo. You should understand the security implications of doing the following. You also might want to restrict the options below to limit the commands that the user can sudo without a password.

myusername    ALL=(ALL) NOPASSWD: ALL
like image 109
Marwan Alsabbagh Avatar answered Oct 01 '22 21:10

Marwan Alsabbagh