If you are trying to run this:
and it has these permissions:
-rwxr--r-- 1 root root 42 Nov 3 14:01 LastBootUpTime.sh
root will be able to do so. Everyone else will get the error
bash: /home/username/LastBootUpTime.sh: Permission denied.
This is because the permissions are such that:
rwx - the owner (root in this instance) can read/write/execute the script
r-- - the group (root group in this instance) can read but neither write nor execute the script
r-- - everyone else can read but neither write nor execute the script
Now, in your case you've explicitly specified this command:
so although you need read permission you do not need execute permission. Therefore there's another reason for the error message. It's most likely that one of the directories is inaccessible to users.
Perhaps your real command is this:
In this instance only the
root user can access the
/root directory, so everyone else will get a permission denied error. The solution is to put the script into a suitably accessible directory (I use
/usr/local/bin on my systems; other people prefer
/opt/bin, but you could place it anywhere that worked for you).