visudo not taking my changes?
by pwjohnston from LinuxQuestions.org on (#53K1H)
Hello, I'm doing this online course and I'm trying to set the ansible user so that it does not need to use sudo, per the instructor's direction. ( I know this isn't good security best practices)
System = CentOS 7
ansible 2.9.6
Code:[ansible@host folder]$ $ id
uid=5001(ansible) gid=5001(ansible) groups=5001(ansible),10(wheel) context=system_u:system_r:unconfined_service_t:s0He says I need to
Code:$ sudo visudo
## Allows people in group wheel to run all commands
#%wheel ALL=(ALL) ALL
## Same thing without a password
%wheel ALL=(ALL) NOPASSWD:ALLThis seems to be consistent with other blogs I read about the subject.
https://www.tecmint.com/run-sudo-com...assword-linux/
https://www.cyberciti.biz/faq/linux-...ut-a-password/
However when I go to test I get:
Code:[ansible@host folder]$ visudo
visudo: /etc/sudoers: Permission deniedI feel like this is the root cause of what is messing me up. In a later chapter, I'm trying to edit this file and it also will not open without sudo
Code:[ansible@host folder]$ ansible-vault edit secret.yml
Vault password:
ERROR! Unable to read source file (/opt/data/edu/hoa-svv/handson-ansible-github/chapter_examples/ch5/secret.yml):
[Errno 13] Permission denied: u'/opt/data/edu/hoa-svv/handson-ansible-github/chapter_examples/ch5/secret.yml'but when I do
Code:[ansible@host folder]$ sudo ansible-vault edit secret.ymlit opens fine.


System = CentOS 7
ansible 2.9.6
Code:[ansible@host folder]$ $ id
uid=5001(ansible) gid=5001(ansible) groups=5001(ansible),10(wheel) context=system_u:system_r:unconfined_service_t:s0He says I need to
Code:$ sudo visudo
## Allows people in group wheel to run all commands
#%wheel ALL=(ALL) ALL
## Same thing without a password
%wheel ALL=(ALL) NOPASSWD:ALLThis seems to be consistent with other blogs I read about the subject.
https://www.tecmint.com/run-sudo-com...assword-linux/
https://www.cyberciti.biz/faq/linux-...ut-a-password/
However when I go to test I get:
Code:[ansible@host folder]$ visudo
visudo: /etc/sudoers: Permission deniedI feel like this is the root cause of what is messing me up. In a later chapter, I'm trying to edit this file and it also will not open without sudo
Code:[ansible@host folder]$ ansible-vault edit secret.yml
Vault password:
ERROR! Unable to read source file (/opt/data/edu/hoa-svv/handson-ansible-github/chapter_examples/ch5/secret.yml):
[Errno 13] Permission denied: u'/opt/data/edu/hoa-svv/handson-ansible-github/chapter_examples/ch5/secret.yml'but when I do
Code:[ansible@host folder]$ sudo ansible-vault edit secret.ymlit opens fine.