Secure Private Folders Making Inaccessible and Undeletable

Posted by Tanmay

If you are so much worried about privacy of your data in your computer then there are some tricks to make private or hide your data. There are available many password protection software that allow you to lock your data. But personally, I don’t like to use so many software in my computer. Especially for those purpose which may be available in Windows without using any soft pack. Here, in this article I’ll describe a simple process to make private some data or any file without using any password protection software.

[Read also: Make Bootable Image(ISO) Of Windows XP Service Pack 3]

At first create a folder in some safe location of your hard drive. It is wise to keep the folder in the “Program Files” folder in the root drive.  Give it any name. Let the name is “Private” for example. Now keep all the file like text files, images, videos or any other type of files which you want to make private, in that folder “Private“. Now we shall make the folder “Private” inaccessible and undeletable as well so that any body can’t able to get access to the content of the folder. The procedure is too simple. You can make any folder private just typing a command in the command prompt.

Tip: Password Protect Folder in Windows.

Open command prompt ( Press Win key+R, type “cmd” in the Run dialogue box and hit “Enter”).

In command prompt type the following syntax:

cacls/e /c /d %username%

For instance, the command should go like this:

cacls Private /e /c /d %username%

That command will make the folder “Private” inaccessible and un-deletable. If any body tries to reach the folder or drop that, the following message will be shown:

Now when you want to reach the folder for your need then type the following syntax in the command prompt and hit “Enter”:

cacls/e /c /g %username%:f

This will return the folder in its normal form.

This trick works in both Windows XP, Windows 7 as well as in Windows vista. But, the file system must be NTFS.

Related: Change Windows User Passwords From Command Prompt

This post was written by Tanmay

Reader Comments

  1. Chaminda

    I have successfully made the folder undeletable and inaccessible. Bur, OMG, I can’t make it accessible again. When I try it on the CMD it gives the message “access denied”. Advise.

    Regards

  2. kris

    hi when i tried the above mentioned command in my pc running on win7 i got the following message” No mapping between the account name and security id was done”.. tried it several times but i was not able to make the folder undeletable and inaccessible.. pls advice

  3. Tanmay

    @Chaminda
    make sure that the user have the full access. As example an administrator account has the all privilege.

  4. Tanmay

    @kris
    It is not clear in what command are you facing the problem? The screen shots in this articles are from Win 7. So it is clear that it works well in Windows 7. You should specify the actual area of your problem so that I can help you. Feel free to share you problem.

  5. kris

    when i type the following command “cacls private /e /c /d %username%” n press enter i get the following message in dos prompt ” no mapping between the account names and the security IDs was done”… i have created the folder on the desktop n tried this command n my file system is NTFS.. i have named the folder “private”

  6. Tanmay

    @kris
    it seems to be that your operating system have a problem. Are you the administrator of your system?

  7. kris

    yeah i am the admin..

  8. kris

    hi it works fine now:-) anyway thanku so much.. this is a wonderful site u got here, got lots of useful info.. keep up the good work buddy:-) looking forward for ur future posts.

  9. Tanmay

    @kris
    Thank you Kris. I’m happy to see that your problem is solved.

  10. Anil

    Hi,

    The technique works fine but if anybody knows the data name inside this folder then he can directly access the data with run command. means if i have made the private folder unaccessible with this command and there is a folder named “One” inside private folder.
    then i can access the internal folder with the run command as C:……Privateone.

    We’ll be able to access the data and even if anybody searches in the parent folder of Private folder for the data type(like search for “*.dat”) which is contained in the Private folder then the results will contain the data from Private folder if any present of that type.

    And we can again easily access the search results of the unaccessible folder. So this technique is not full proof and don’t rely on it blindly.

    I tested it in Windows 7.

  11. Tanmay

    @Anil,
    You are quite right. If any body knows the exact name of your secret file then he can play with that. But this article has written on the virtue that your friend or any body does not know the file name but you want to prevent them to discover your secret file names when accessing data. It should not visible in the search results as the folder is not accessible for a specific user. It depends on user information in that computer. If there are more than one user then make the folder inaccessible for each user. However thank you for your investigation. Keep it on and let me know if you have any other query.

  12. hii i like it and it works on win 7 if you .
    i have an extra feature for this if you want to lock any folder in your computer in win7 then go to start then programs accessories then right click on the command prompt and run it as administrator.you can lock any folder in computer.
    visit my blog definitelyearn.blogspot.com

  13. bilal haider

    I tried it successfuly. but its unsecure. :(
    any trick to secure it (lock it) from other users who have administrator rights too so that information is made unavailable in searches. like search “*.doc” etc. ?

  14. ajay

    hey..its a good idea…but i cant make it accessible again :(
    please help me……….

    • Tanmay

      @ajay
      Yes you can make it accessible by the command described in the article. But it is not possible to permanently make inaccessible the folder here. The folder can be made inaccessible for some user of your computer. Thank you for your comment.

  15. suprit

    Hi… i m able to make all my folders accessible and inaccessible except 1. i made 1 already created folder name viedos-s inaccessible which contains some other files and folders. now i m unable to make it accessible again. please help… i have all privilages…..

  16. Tanmay

    @Suprit,
    write the command properly. It should make it able to return in the normal form.

  17. vincent soko

    to make things easy just create two batch files using note pad and name then as key and the other one as lock
    all you have to do is double click
    KEY
    cacls /e /c /g %username%:f

    LOCK
    cacls /e /c /d %username%
    You can save it any were even in you flash drive

  18. vincent soko

    to make things easy just create two batch files using note pad and name then as key and the other one as lock
    all you have to do is double click
    KEY
    cacls (directory here) (folder name here ) /e /c /g %username%:f

    LOCK
    cacls (directory here) (folder name here )/e /c /d %username%
    You can save it any were even in you flash drive

  19. Tanmay

    @Vincent Soko,
    Thanks for your tips. We shall update in in this article.

  20. MSDOS indeed has powerful commands such as these to perform advanced tasks. This Access Control List (ACL) command is really of great use edit and display file permissions on NTFS partitions. This is one of the best ways I have ever known to make folders completely private. Thanks for sharing Tanmay….

  21. Tanmay

    @Ramaraobobby: Thank you.

  22. deepak

    Hi,
    Can i make one private folder in external USB drive , so no one can access that folder in any system, without my permission
    Please advice

  23. @Deepak: This tutorial uses A DOS command Cacls which can be run only on NTFS file system. So if your external drive file system is NTFS then you can. But that is not more secured if you want to make inaccessible your folder by this method as your friend or any third party can know about the command. Then he/she can easily use the reverse command to access that. The best way is to password protect your folder. I wrote about that tutorial. Click here to visit

  24. deepak

    Hi,
    Thanks for the suggestion.

  25. utteb

    It worked bu i am unable to access again.

    Advise

  26. Tanmay

    @Utteb: Just run the command cacls /e /c /g %username%:f. You should able to access the folder again.

  27. grouver

    Thnks buddy it helps a lot I guess it works the same as secuKeeper but the difference is it cant be unlock with the same command which make it totally inaccessible any idea how it works?

    try adding this code inside your inaccessible folder:

    attrib +s +h *.* /s /d (save as anyname.bat to hide everything)
    attrib -s -h *.* /s /d (to undo the effect)

    it helps to prevent locating the files on command prompt.

  28. grouver

    I forgot the bat files you created will not be excluded try adding additional line example the bat file I created name hide.bat

    attrib +s +h *.* /s /d
    attrib -s -h hide.bat

    thanks again..

  29. Tanmay

    @Grouver: You are welcome. Thanks for sharing.

  30. Grouver

    Hey I got problem regarding the code I cant access it even typing the correct command I got denied many times I successfully turn the other programs and folders to their original attributes except the 3 software I got

    bootskin.exe
    ccsetup233.exe
    Faronic_DFS (folder and deep freeze files contained inside)

    any idea why?

  31. Grouver

    Thanks God I found a solution for this bug ^_^!
    for those who got the same error try searching SubInACL.exe
    hotfix from Microsoft.

    anyway thnxs again tanmay for sharing.. this is a very useful command… I hope you can share more tips with regards on bat files programing.

  32. Tanmay

    Hi Grouver. Thanks for your appreciation. Any way you can also see another interesting post with batch file. Here it is http://www.techtipsgeek.com/password-protect-folder-without-using-software-windows/3947/

  33. Grouver

    Thanks tanmay I’ve seen that post before. Good luck and keep-up the good work and If you want can try using editv32 to mask the password with asterisk, you can use that as substitute to set command on bat files and there are lots of options you can use. I also tried this on vista and it works.

  34. kamal

    nice but with error
    it make my folder Inaccessible and Undeletable but when i delete the folder it delete the folder inside files

  35. kamal

    when i type the following command “cacls private /e /c /d %username%” n press enter i get the following message in dos prompt ” no mapping between the account names and the security IDs was done” n i m the admin of my pc

  36. kamal

    yaa thanks for help this is really a gud trick and helpful

  37. kamal

    thanks it really a nice and very helpful trick

  38. Tanmay

    @Kamal: Thanks for your appreciation. Keeping reading.

  39. skwatterz

    works 100% in here thanks a lot

  40. aijolee

    Same PROBLEM! I am logged as Administrator but when I tried to undo my changes using your trick: cacls Filename /e /c /d %username%:c, I got a message saying:No mapping between account names

    • Tanmay

      @aijolee: May be there is some problem with user accounts in your computer.

  41. phaw

    not working on me, im running xp pro but i cant make it inaccessible

  42. Tanmay

    Phaw: Make sure that your file system is NTFS or not. Also try to apply this trick as the administrator of your XP. Let me know if this solves your problem. Thanks for sharing with us.

  43. Nice hack but I prefer doing stuff like this with a software. I’m using the free version of My LockBox and it works just fine for me ;-)

  44. Tanmay

    @Chukwudi: This is a tutorial for those who want to avoid extra software in their machine.

  45. Tom

    If someone stole your hard drive, they could also easily access the data by putting it into their computer, then using the same “cacls” command to give them ownership over the folder.

    Or if the other users have Administrator rights, they could also use the “cacls” command to change the ownership.

  46. Tanmay

    Yes Tom. You are right. This is not the ultimate way. But you can make your confidential mores secure by a simple trick.

  47. Tom

    Hi this is great! but how can I make the folder undeletable but yet accessible please? I tried /g %username%:R C but that didn’t seem to work and giving actual “User” or “Domain” resulted in an error message saying “account names not mapped to security ID”

    Please help

    cheers

  48. Tom

    Also is there a way to password protect this atall? Would be great to see an article on password protecting USB flash drives, its folders, files …

    ta

  49. Tanmay

    Tom: Frankly I also tried to do that but still not succeeded. Once I get any way will publish here.

    About password protecting a folder: You might find your answer here: http://www.techtipsgeek.com/password-protect-folder-without-using-software-windows/3947/

  50. Tanmay

    Thanks Tom for the suggestion. I will definitely cover some article on password protecting USB drive. Keep reading.

  51. Lenincha

    Hola Tanmay, me agrada el tema, pero mi consulta está en lo siguiente: para que me puedas sugerir, dime por favor como puedo hacer la operación en caso de que tengo en mi maquina instalado dos discos duros y un sistema operativo diferente en cada uno de ellos, ademas que para cada sistema existen de 4 a cinco usuarios incluido el administrador, por lo que es de suponerse que hay dos administradores como minimo en la PC, cual seria la sintaxis? para poder proteger correctamente una carpeta ubicada en el disco de otro sistema? .. Gracias de antemano …. Saludos

    “Hi Tanmay, I like the subject, but my query is as follows: that I can suggest, please tell me how I can do the operation if installed in my machine I have two hard drives and a different operating system on each of them, besides that for every system there are 4 to five users including the administrator, so it is assumed that two administrators at least in the PC, what would the syntax? to properly protect a folder on the disk of another system? .. Thanks in advance …. Greetings”

  52. Tanmay

    @Lenincha: You can apply the command on any location. Just navigate to the folder location in that different hard disk from the command prompt. You can use cd command.
    This tutorial is based on Windows system and will not work for different OS.
    Thanks for your comment. Keep your reading at TechTipsGeek

  53. Shlesh

    it worked while locking but it didnt worked while unlocking. what do i do. it worked for an empty folder so i locked my important files. nad its displaying access_denined. what do i do. please help…

  54. Tanmay

    cacls /e /c /g %username%:f
    The above command should unlock the folder. If not, then please make sure that you are the admin user of your computer. If you are using windows 7, run the command prompt as administrator (type cmd in the start menu search box > right-click on “Command prompt” > click on “Run as administrator”). Then run the above unlocking command. Let me know if this solved your problem.

  55. chandu

    Hi…when i’m trying to lock, it is showing error like this…

    cacls is not an internal or external command…
    wat can i do…?

  56. James

    Hi I have locked the folder but how can I unlock it. I am using windows 7 and I have made the folder inaccessible to myself. How exactly do I use the administrator account?

  57. Tanmay

    Run command prompt as administrator. You can do it by Start > All programs > Accessories > right-click on command prompt >Select Run as administrator. Then navigate to the folder location and type exactly the following command replacing with yours.
    cacls /e /c /g %username%:f

  58. buhari4u

    i use cacls foldername /E /P everyone:n to lock a folder,to unlock that folder i try f instead of n but it shows “Access denied”,i also tried with y instead of n.bt it also not working.pls help me to unlock the folder

  59. M Zia

    sir is this option(to make folder inaccessible) only for NFTS or also for FAT32 thanks

  60. Tanmay

    @M Zia: I have already mentioned that it works only on NTFS file system. However, thanks for your comment.

  61. Benjamin

    Can I protect harddrive in win7 x64 so other users can view/read ONLY and not write, delete, copy datas to that drive

  62. jeff

    i must say this is pretty stupid. Anyone with knowledge of security rights of ntfs will simply go to the security tab (in properties, it even tells you) and retake ownership/privieleges of the folder.

  63. This tip not used for FAT32….so made NTFS first….okay

  64. Jan

    A word to the wise: This method is NOT secure.

    First, anybody knowing (or guessing) a file name can access it.
    Second, anybody with any knowledge about NTFS security (like, goning to the root of C: and typing CACLS * /T /G BUILTINusers:RW) can break it.
    Third, anybody booting your PC into a Linux CD/USB stick can access everything (as he will have full root/administrator access on the Linux OS, he can override your NTFS permissions).
    In effect, your method just *may* be good enough to keep your mom out of your image collection, but even your little sister could get in.

    If an attacker has physical access to your PC, only encryption can protect your data.
    I would strongly recommend installing TrueCrypt – it’s free, it uses strong encryption that’s likely to withstand even determined attackers with both knowledge and resources, and it’s open source – important in security software because it can be and has been reviewed by independent researchers.
    To be really safe against professional adversaries, you would need to encrypt the full hard disk so the encryption works before booting into Windows, but for 99% of the people out there an encrypted “virtual drive” is good enough. (Yes, an attacker may be able to stitch together some useful data from your page file, but this is way beyond most moms and little sisters).

  65. Ramesh

    Hi, I tried this it works fine. Thanks for this post. If any way like this, to make the file be an undeletable?

  66. leonides

    it can be easily access when u r using windows 7, just go to security tab then advanced to edit the permission.

  67. Ramesh

    Hi, I tried this it works fine. Thanks for this post. If any way like this, to make the file be an undeletable?

  68. prabhakar

    thanks so much nice to do thats all.

  69. maddy

    hi Tanmay bro i think u remember me.i tried this trick but its not working for me iam not clearly getting were to put space in command prompt so kindly help.iam using windows xp service pack 2

    thanks Regards
    maddy

  70. maddy

    tanmay iam getting that system cannot find the specified file bro

  71. Tanmay

    @Maddy: I think you are doing mistake to specify the file path.

  72. maddy

    tanmay iam using win xp kindly teach me as easiest as possible

  73. mudaser

    hi tanmay
    i have locked the folder sucessfully,after that i have format the c: (drive),same NTFS(filesystem) is there before formating and after formating,now iam trying to unlock the folder but it is not working???… please help me

  74. Himalay

    hello tanmay,
    its not working in my pc win7
    its showing error “Invalid parameter ‘admin’”
    now what i have to do??

  75. Tanmay

    put %username% rather than admin when you are logged in with the admin user privilege.

  76. Asif Raza

    i am using windows xp sp3 with ntfs file system and i am single user i donot know how to make my folder inaccessible on the desktop screen,i am the administrator of this computer but sometimes my friends can use this computer and i want to save my data from my friends, i wrote the command in command prompt as under
    c:Documents and SettingsAdministratorDesktopcacls one /e /c/ /d %Admin%
    because when i check my coputer’s properties it is registered to Admin so when i entered in the command prompt the following message appered no mapping between account names and security ids was done
    please guide me through my mail id is as under
    [email protected]

  77. Asif Raza

    i made a file inaccessible on desktop successfuly and reaccessible too but the problem in your command is that in windows 7 a kid can also delete it if he will press SHIFT+DELETE
    because if you want to delete it even in inaccessible mode just press shift+delete it will be removed permanently

  78. Viral

    Hey It work Thanks man…… can u give any such command that can also denial copy and cut option…..
    I don’t Want to use any Software……….. this slight mistake in your tricks i.e corrected by me …. so the complete command is …..

    cacls path-of-folder  /e /c /d %username%     — this will make folder inaccessible and undeletable
    cacls path-of-folder  /e /c /d %username%     — this bring back to normal mode…..

  79. noha

    hey tanmay sir,
    i locked my f drive using the following command
    ” cacls f: /e /p everyone:n ” and it got locked
    and then i opened cmd as administrator and then i tried to unlock my f: drive using the command ‘ cacls f: /e /p everyone:f ” but its not opening its saying acess denied.