Friday, May 10, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 26708  / 2 Years ago, thu, january 6, 2022, 6:54:19

Is there any way to lock a folder from terminal(protected with password) without using any third party applications like truecrypt,crypteeper nor giving user permissions.



It was just like whenever a user try to open that folder,it suddenly prompt for password.The given password must not be similar to sudo password.


More From » command-line

 Answers
4

May be too naive but how about the following:



Let Dir be the directory to be password protected with password qwerty.



mv -n Dir qwerty
mkdir Dir
mv qwerty Dir/.
chmod a-r Dir


This just creates a folder called querty inside Dir with the contents of Dir and removes read permissions to Dir.






To access from terminal:



cd Dir/qwerty


or



cd Dir/
cd qwerty/


Note that pressing tab or typing ls won't reveal qwerty. In other words you need to know qwerty to reach the original contents of Dir.






To access from nautilus:



Navigate to Dir. Press Ctrl+L. Type qwerty in the location bar to enter.






Changing password:



cd Dir
mv qwerty newpassword





This method has quite a few issues.




  1. After gaining access the password will be clearly visible for all to see in the terminal prompt or nautilus address bar.

  2. Scripts inside Dir which depend on their exact location in the filesystem won't work properly.

  3. Most importantly, sys-admins will be able to access contents without the password - this may not be desirable.



Apart from these there could be other security flaws: this was never intended to be an encryption scheme. That said, from the sound of the question, I guess this might be sufficient.


[#28314] Friday, January 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ilityushing

Total Points: 18
Total Questions: 100
Total Answers: 113

Location: Senegal
Member since Wed, May 13, 2020
4 Years ago
;