In Windows UAC, if the user attempts to run an executable file, the OS will prompt the user whether or not they intend to run it. Similarly, if the application requires admin privs, the user is prompted to allow this. In both instances, the preference can be remembered, essentially appending to two whitelists. If the file is modified, it is removed from said whitelists and the user will be prompted again.

In linux we have a Sudoers file where we can specify files that can be run as root (Or any other user) without having to type in the password each time. This is great for applications that need to autostart with sudo permissions, especially in the case of a GUI app autostarting (With gksudo) but therein lies a security implication. If the file is modified, sudo without password ability is not removed. Is there any way to invoke this behavior?

I imagine that UAC uses file hashes to keep track of changes. I'm thinking there must be a way to handle this in Linux but I can't seem to find it as of yet.

  • sudo command is used to start somethig as a root (in general), without using root user password. caching a password for some time is only an addition. from what i understand you would like sudo to remove password from cache when it was cached for particular program and the content of it has changed? and remember forever for programs that doesn't change? – rsm Jan 17 '17 at 19:30
  • and what should it do when libraries change? or config files? or environment settings (changing program behaviour)? it looks like whole another layer to me, complicated and not really necessary, since sudo cache password only for a short period of time, so whole this additional logic will get flushed constantly. – rsm Jan 17 '17 at 19:30
  • also, please check superuser.com/questions/242903/windows-uac-vs-linux-sudo?rq=1 question, there is nice OAC and sudo comparison. – rsm Jan 17 '17 at 19:38

The whole Linux security model is built upon file permissions. So the correct way of protecting an executable listed in sudoers is to make sure users can't modify it. This is not exactly the same as UAC does, but it's similar in terms of security:

  • On Windows, you can modify the file freely, but you need to provide the admin password every time you want to run a modified version.
  • On Linux, you can always run a file listed in sudoers, but you need to provide the root password every time you need to modify it.

See also: Windows UAC vs. Linux sudo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.