Sometimes in Linux you set a folder’s permissions to 777
(meaning everyone should be able to use it), but you still can’t get inside.
Here’s an example:
$ cd /root/whisper.cpp/samples
-bash: cd: /root/whisper.cpp/samples: Permission denied
$ ls /root/whisper.cpp/samples
ls: cannot access '/root/whisper.cpp/samples': Permission denied

But wait — we already did this earlier:
chmod 777 /root/whisper.cpp/samples
So why are we still getting blocked?
What’s Really Happening
Linux checks every folder on the way to your target.
- To enter
samples/
, the system first checks if you can go through/root
, then/root/whisper.cpp
. - If either parent folder denies you “execute” (traverse) permission, you can’t get in — even if
samples/
itself is wide open.
Think of it like this:
You want to enter a bedroom (the samples/
folder). But first, you need to unlock the front door (/root
) and the hallway (/root/whisper.cpp
). If either door is locked, you’ll never reach the bedroom.
That’s exactly what’s happening here.
How to Fix It
Best Way: Move the Project Out of /root
Instead of keeping your project in /root
(which is for the superuser), move it to a normal location like your home folder:
sudo mv /root/whisper.cpp /home/username/
sudo chown -R username:username /home/username/whisper.cpp
Now you can cd
and ls
without issues.
Quick Shortcut (Less Secure)
If you want to keep it in /root
, you must give “execute” permission to the parent directories so you can pass through:
sudo chmod +x /root
sudo chmod 755 /root/whisper.cpp
⚠️ But be careful — /root
is private for a reason, and opening it can reduce security.
Takeaway
In Linux, permissions don’t stop at the folder you’re targeting.
You also need permission for every parent folder above it.
So next time you see Permission denied, check the whole path — not just the final directory.