I am trying to run a shell script that contains the command
$locate /etc/*.conf
to find all files in /etc/ that end in .conf, but whenever I run the script the command line says /etc/chrony.conf: Permission denied
. Whenever I run the command on its own in the command line it executes fine but from the script it fails. I have updated the script permissions with chmod, tried running the script with sudo privileges, giving sudo privileges inside the script itself, and even logging in as root but it is still saying permission denied.
Any help is appreciated, thanks!