Yesterday I followed a thread trying to learn to lock file folders using the cacls in the command window. I thought I'd use the temp file folder as my target, thinking that it was the most innocent folder I had. I was able to lock it, but now I can't unlock it.

Here is the code that I used to lock it:
cacls %temp% /G %username%:R

it asked me: Are you sure <Y/N> I replied Y, and it returned "processed dir: C:\DPCUME~1\HASLAM~4.AFT\LOCALS~1\Temp

I could confirm that I was unable to save anything to the temp folder. So I then wanted to unlock the folder. I used the following code:

cacls %temp% /E /T /C /G %username%:F .nul

It returns : Access is denied.

If I use the exact path to the filename instead of %temp%, I get:
The trust relationship between this workstation and the primary domain failed.

I can't download files: tells me I don't have permissions
I can't save word documents: tells me I don't have permissions
I can't read Eudora email: tells me it can't access the temp folder

I am stuck. Any thoughts on the steps I need to follow to get this working? Would a system restore take me back to how I was before?

Thanks.

Recommended Answers

All 18 Replies

First - a workaround. Change your TEMP envirionment variable so you can function..
Right-click My Computer and click Properties, select Advanced, click Environment Variables button and edit the TEMP variable to C:\TEMP. Create C:\TEMP if it doesn't already exist. Log off and back on. You should now have an accessible Temp folder.

Next, after logging in as an administrator (local or domain), browse to the affected Temp folder in Windows Explorer. From Properties on that folder, select Security, click Advanced, select the Owner tab, select Administrators, check the "Replace owner on subcontainers" box, and click Apply. You can then select the Permissions tab and grant Administrators full-control, and Users-Modify access.

Log off and back on as yourself - you should be able to CD to the old temp folder and create/delete files. Restore your original TEMP variable definition if you can access the personal temp location.

NEVER play with CACLS using only the /G option, as that will remove all System access and permit only the account(s) you specify, requiring the steps above to be performed as an admin to recover access. IF you want to experiment with CACLS, use /E to edit the permissions and grant specific access to a different account. You can use runas to open a command window with alternate credentials and test access rights with little or no ill effects.

Glenn

Thanks Glenn, your suggestions did the trick. Thank you so much!

Thanks! Good to hear it helped!

G-

hey

Yesterday I followed a thread trying to learn to lock file folders using the cacls in the command window. I thought I'd use the "F:\songs" file folder in my "F:" as my target,....actually that folder has huge contents.....folder size may be more than 20GB..... I was able to lock it, but now I can't unlock it.

Here is the code that I used to lock it:
F:\cacls songs /E /P everyone:n
then it showed...

processed dir F:\songs

I could confirm that I was unable to access that folder......... So I then wanted to unlock the folder. I used the following code:

F:\cacls songs /E /P everyone:f

It returns : Access is denied.

...........

what should i do now...i cant access that folder........please reply this soon..........

Neat. It locked you out so you couldn't change it back. Shouldn't it do that?

Ok... jus foolin widja.
songs is the directory on F:, correct?
K, run these in cmd:
cd /d f:
cacls songs /p everyone:f
-it should work.... Since you are doing a blanket change of all users' rights, you don't need the /e parameter.
Check result by
dir songs
...or just browse to songs in Explorer. Next time, play with scratch files or folders you create just so.

hey

Before 2 days, I followed a thread trying to learn to lock file folders using the cacls in the command window.
nd i tried it on my very important folder ,which contain all my important documents ,files,and software...it is of approx size 25 GB.... I was able to lock it.My folder is in
"d:\kpg"
i lock this by this command
c:\>cacls d:kpg /d everyone
it was done...
bt when i tries to unlock it...
c:\> cacls d:kpg /g everyone:f
It give an msg "access is denies"

i hv also tried->
d:\>cacls kpg /p everyone:f
bt it give same msg...

Wht should i do...
Plz Help me...
I m in big trouble..
Plz help me
Plzzzzzzzzzzzzzzzzzz...
As soon as Possible

hey

Before 2 days, I followed a thread trying to learn to lock file folders using the cacls in the command window.
nd i tried it on my very important folder ,which contain all my important documents ,files,and software...it is of approx size 25 GB.... I was able to lock it.My folder is in
"d:\kpg"
i lock this by this command
c:\>cacls d:kpg /d everyone
it was done...
bt when i tries to unlock it...
c:\> cacls d:kpg /g everyone:f
It give an msg "access is denies"

i hv also tried->
d:\>cacls kpg /p everyone:f
bt it give same msg...

Wht should i do...
Plz Help me...
I m in big trouble..
Plz help me
Plzzzzzzzzzzzzzzzzzz...
As soon as Possible

I must admit.... tsk... you deny all permissions to Everyone and then expect anyone to be able to get access? Luckily, this is XP.
If you used cacls d:\kpg /p everyone:n OR cacls d:\kpg /d everyone to lock then the /e parameter will not allow any cmd containing it to work [there are no permissions to edit] eg. cacls d:\kpg /e /p everyone:f will fail, as should cacls d:\kpg /e /r everyone.
Interesting that cacls d:\kpg /p everyone:f did not work for you. It should, it creates new rights in the acl.
cacls d:\kpg /g everyone:f should have worked, also.
Try cacls d:\kpg /e /r everyone, just in case.

Note that you must be an administrator to use cacls. Anyway, perhaps if you ran this and pasted the result the situation could be clearer..
cacls d:\kpg

Admins and their privacy rules which limit access... tsk. What a nuisance!

I HAVE USED THE FOLLOWING COMMAND
cacls c:\ /p everyone:n
it precoessed successfully
but when i tried to execute
cacls c:\ /p everyone:f

its showing access denied.

also through the administrator i m unable to change the setting

Try this one:
Type CMD in Start Search. Right click on CMD and choose to "Run as Administrator".
In the Command Prompt window type the lines below and hit Enter. Confirm the command after.
icacls "C:\Users\Public\Public Desktop" /GRANT Everyone:F /T
If it gives you the same error you may need to MANUALLY add Everyone with Full Control on the target folder.

I had a folder in D drive "My Docs" which i lock this it this command
cacls "D:\My Docs" /d xyz or maybe instead of xyz i might have typed everyone, this is atleast what I think has happenned


NDOWS>cacls "D:\My Doc
ou sure (Y/N)?y
s is denied.


But when I tried to unlock it by all the methods written above i get this error.. Now I agree i might have made it inaccesible to all users, but that folder contains very very very important data, and also all my academic data.
What should I DO... Please Help...

i locked folder with 'D:cacls no /e /p everyone:n' but after i formated the C: drive and put the same OS(that is WIN XP) from another cd. My folder that is 'no' i on drive D: but now i cannot open the drive with cmd 'D:cacls /e /p everyone:f' it also dont grant the permission to anothe user so how can i unlock the folder???

have a admin account and guest is offf...have locked a folder named pass in f drive .how to unlock.

I locked a folder within a folder with cacls command (it was in drive g).
g:
cd "az"
cacls "pics" /e /c /d %username%

it actually worked and is unlockable with
cacls "pics" /e /c /g %username%:f

it worked for about 2weeks but now it does not work. all it says is "you dont currently have permission to access this folder"

please help, I have my documents in that folder including flight documents. please reply ASAP.

Try opening a shell as Admin and typing

cacls pics /e /g %username%:full

but if that doesn't work you could always boot into a linux livecd and just copy the files to another folder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.