I am learning Linux and permissions.
I have following folders dir1/dir2/dir3 and the file myfile.txt within dir3.
I am trying to give permission chmod 700 to dir1 and dir2 to both folders and files but to all files and folders within dir3 I want to give permission chmod 777.
According to this post I did following:
To change permission for dir1 and all the directories within dir1 to chmod 700
find /home/user/dir1 -type d -exec chmod 700 {} \;
To change all the files within dir1 to chmod 700 including the sub-folders
find /home/user/dir1 -type f -exec chmod 700 {} \;
After that I did following:
To change permission to dir3 and all the directories within dir3 to chmod 777
find /home/user/dir1/dir2/dir3 -type d -exec chmod 777 {} \;
To change permission to all the files within dir3 to chmod 700
find /home/user/dir1/dir2/dir3 -type f -exec chmod 777 {} \;
When I check permission with ls -al everything looks fine but when I change the user and try to get access to dir3 and myfile.txt I am always getting message "Permission denied" .
What am doing wrong? Is there some better way to do that I want?