find . -type d -exec chmod +x {} \\;
I found out that the above command is not the solution.
I can't change to a directory, but I can list its contents with ls -la
, and it looks like this.
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
?????????? ? ? ? ? ? '30drop - Tools For The Dimensional Step [2015] [FLAC]'
?????????? ? ? ? ? ? 'Ada Kaleh - Zâna Zorilor'
?????????? ? ? ? ? ? 'Aes Dana - Perimeters [2011] [FLAC]'
?????????? ? ? ? ? ? 'After Hour - Feel It & Waterfalls [1991] [FLAC]'
I tried changing the owner and tried setting permissions to 777, but neither one works. It's either permission denied
or operation not permitted
. The files are definitely there and they are not deleted, but how do I regain access to them?
I really did not have any idea why a chmod -x
recursive command would be dangerous like this, but it definitely is.
When you ran
chmod -x
on the directory with the-R
(recursive) option, it removed the execute permission on the directory itself and all its subdirectories. This was wrong because:x
) on a directory is essential for accessing it usingcd
and listing its contents correctly.ls -la
output showing thed?????????
entries and series of question marks for owner, group, and permissions.Use the
chmod u+rx,go-w <directory name>
command to modify the permissions of a specific directory.Explanation of
chmod u+rx,go-w
:chmod
modifies the permissions and access mode of files and directories.u
stands for the user (the owner of the directory).+r
gives read permission to the user.+x
gives execute permission to the user.g
stands for the group (users who are in the same group as the owner).o
stands for others.-w
removes the write permission for both group members and others.