Permission for all commands, but unable to clear cache

You are running sync with sudo, but not the shell's redirection of the echo. Instead do:

sudo sh -c 'sync; echo 1 > /proc/sys/vm/drop_caches'

or

sudo sync; echo 1 | sudo tee /proc/sys/vm/drop_caches >/dev/null