Sudo and Opendoas on Linux use timestamp files to keep track of how long it's been since you've last entered your password. Doas on BSD uses a kernel feature instead.
Why is the latter considered more secure?
Sudo and Opendoas on Linux use timestamp files to keep track of how long it's been since you've last entered your password. Doas on BSD uses a kernel feature instead.
Why is the latter considered more secure?
The sudoers timestamp file is only writable by root, so it cannot be modified by any normal user. However, a user that has root access (e.g. via sudo) can keep overwriting the timestamp file to prevent being prompted for the password again in future. This is only really relevant in a situation where an attacker gains access to an interactive terminal session where sudo has been used very recently.
Moving this tracking to the kernel makes it slightly more secure, because the attacker would have to load a kernel module to modify the timestamp, and that's a bit noisier and requires making such a module. It isn't really a concrete barrier, it's just a bit more work for an attacker.