Is there any possibilities to protect the directory using the PIN number in Linux. But we need to add or modify files inside the encrypted directory.
There's a semi-secure way (as the developer of the tools mention that this tool can be vulnerable to some kind of attack method) but useful way. using encfs
first, you need to install it via a package manager.
sudo apt install encfs
Note that during installation, the package manager will notice about vulnerability
then you need to run the program to create the directory and its raw storage directory. with this command you do this:
encfs ~/.crypt ~/crypt
After this step, it will say to enter expert or normal mode. select what you wish and enter your desirable password.
The last step is unmounting the directory to protect data. for that just do this:
sudo umount ~/crypt
you can use the GUI way.
also, you can use Unix permissions which mentioned here.