0
I am testing something in docker, it requires sudo without entering password, I added required entries in /etc/sudoers. After that in host it doesn't ask for password. But in case of docker it still ask for password. BTW, I am running fedora 24 in VirtualBox VM on a Fedora 24 host.
Here is the details...
abc@webster $ sudo bash
root@webster $ cat /etc/sudoers
## Sudoers allows particular users to run various commands as
...
...
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
%users ALL=(ALL) ALL
%admin ALL=(ALL) NOPASSWD: ALL
%sudo ALL=(ALL:ALL) ALL
abc ALL=(ALL) NOPASSWD: ALL
#abc ALL=(ALL) ALL
abc@webster $ id
uid=1000(abc) gid=1000(abc) groups=1000(abc),10(wheel),100(users),977(docker),1001(admin) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
abc@fc-docker $ sudo bash
[sudo] password for abc:
1The container/image has its own
/etc/sudoers
file. – tkausl – 2018-02-20T05:18:51.793Thanks @tkausl. I just noticed it doesn't accept the sudo password as well. It asks for it 3 times and throws this error "sudo: 3 incorrect password attempts" I changed the password to very simple one and still it throws same issue. BTW, the fedora 24 is a VirtualBox VM. – Chandrasekar – 2018-02-20T05:25:31.063
Hi @tkausl, I tried a different way and solved the problem. I used to log in to docker as " docker exec -it --user abc fc-docker bash ", when I removed the user part and logged in like, " docker exec -it fc-docker bash ", I logged in as root. Then I modified /etc/sudoers to NO PASSWORD. Not its working fine. Thanks. – Chandrasekar – 2018-03-05T12:14:04.673