Views: 680
I am using ansible and want to avoid password when installing stuff as root
I usually use an AWS VC2 for development, but this time I decided to use VMware. When doing sudo Ubuntu and others ask for a password. I thought that EC2 does the passwordless elevation with keys, but found that it does it the same way as below with NOPASSWD , just that this info is hidden in /etc/sudoers.d/cloud-init . Check out
https://askubuntu.com/questions/192050/how-to-run-sudo-command-with-no-password
# ubuntu user is default user in cloud-images.
# It needs passwordless sudo functionality.
ubuntu ALL=(ALL) NOPASSWD:ALL
In order to do it with a bit less security you need to configure that file not ask for passwords. Ubuntu had added the first user to
open visudo
edit the line
%sys ALL=(ALL) ALL Change it to
%sys ALL=(ALL) NOPASSWD: ALL save it, and now it should work, you can also do it per user instead of group
Source: How to Run ‘sudo’ Command Without Entering a Password in Linux