I'm required to empty the linux buffer cache in a python script, that runs on a Debian wheezy VM.As root I run sync; echo 3 | sudo tee /proc/sys/vm/drop_caches, but the script is run by a user, without root privileges.  I've thought of the following possibilities:give the user write permissions on the file /proc/sys/vm/drop_caches(which doesn't seem to work, as I get Operation not permitted when I chmod 646 /proc/sys/vm/drop_caches)Set the setuid on tee, which should work but then the user could go apesh*t with teeI could setuid on the script and remove write permissions for the user to write to the script, so he couldn't alter it (but then again, that's bad, as the user may interact with the code)or I could write a tiny bash script featuring only the empty the linux buffer cache process, then remove write/read permissions, setuid and add execution permission for the userWhat is the sanest way to solve this? 
How to enable a non-root user to empty the linux buffer cache
debian;permissions;cache;setuid;buffer
From your list, only the fourth possibility (writing a small setuid script in a safe directory e.g. /usr/local/bin not changeable by the user) might work and could be safe, but is nowadays often disabled by the distribution.The easier and better option is to add the following line to /etc/sudoers (use e.g. visudo for this)YOURUSERNAME     ALL = NOPASSWD: /sbin/sysctl vm.drop_caches=3and then include the linesudo /sbin/sysctl vm.drop_caches=3in your script.