Ubuntu 18.04 restrict folder access to a certain user in linux command line

Job ID: 33899774

Budget: €8 – €30 EUR

I have two users in ubuntu 18.04 and both right now have full access to every folder in the system. Let's say user1 has its home path at /home/user1 and user2 at /home/user2. I would like user1 to keep having full access everywhere even at /home/user2 /, /home etc. But user2 should have only read and write access (not execute) at /home/user1/folder1/folder2/folder3 that's only folder3 and its subfolders. User2 should be able to traverse folder1 folder2 but shouldn't be allowed in. Also any subfolder inside folder3 should be accessible to user2 (read and write only). user2 should only have read access to his home directory /home/user2 (not execute, nor write).

You should be able to provide the solution in the form of linux commands and explain your thought process. Access to the actual system will not be granted.
Related categories: System Admin Linux Shell Script UNIX Ubuntu