I have execute permission only on a directory, which I believe means that I can search for a particular filename in that directory. However, when I’m in the directory and do:
find . -name "file.txt"
I get a permission denied error for the directory. Which command should I use?
findtries to read the directory, and you’ve said you don’t have permission to read the directory. The search permission on the directory means you have permission to access the files (subject to the permissions on the file itself, of course) if you know the name of the file. The absence of read permission on the directory means that you cannot find out which files are in the directory except by trial-and-error or externally granted knowledge.What do you want to do with the file?
cat file.txtshould work.ls -l file.txtshould work.cp file.txt /some/where/readableshould work.