Make file undeleteable but accessable

0

0

Iam having a problem with denying current user from deleting file on desktop.
I tried to use icacls with:

icacls file /grant:r %username%:(X,AD,WD,RD) 

from site but it didnt help
I tried to deny only delete permission but it also didnt help.
Is there anyway to make desktop files undeletable but accessable using Shell or C++? I mean I like to be able to move icon around desktop but I want to make icon not able to delete or move to another folder. Iam using Windows xp and I need to make it under Windows xp.

user1042321

Posted 2011-11-29T14:54:25.697

Reputation:

1What OS is this? – Chris Eberle – 2011-11-29T14:55:36.757

@Chris: Windows XP. – Blender – 2011-11-29T14:57:01.780

4What does this have to do with C++ ? – Paul R – 2011-11-29T14:57:42.433

1Also, wouldn't a user absolutely hate it when an application makes undeletable files? – None – 2011-11-29T15:03:23.977

icacls didn't exist until Windows Vista. You need to use cacls instead, or the GUI. – Harry Johnston – 2011-11-30T02:49:26.880

Answers

3

Your syntax is wrong. You are granting permissions, but you have to deny them.

Try:

icacls file /deny %username%:D

Complete syntax: Icacls

Dennis

Posted 2011-11-29T14:54:25.697

Reputation: 42 934

Dennis i already said that i tried this way. It didnt help also. It make file with none permission so icannot open it i cannot delete it and i cannot move it to another directory. This is not what i need, i need file to be undeleteable and accessable – None – 2011-11-29T15:45:06.407

You can't make a file undeleteable and movable! The very act of moving a file can force an OS to move the file from one disk to another. By definition, you are copying and deleting. What is your ultimate goal here? Perhaps you are using the wrong tools. – surfasb – 2011-11-29T18:07:47.693

Ok so i like tomake file copyable but not deleteable. I just dont want to any1 delete my icons on desktop, but let them access to them(read and write). – None – 2011-11-29T18:29:24.953

surfasb thank you for solution but as I said before Iam using windows xp and I dont have here a tab called: security. I can import my actual c++ code to c# if it helps somehow. – None – 2011-11-30T02:02:45.583

@Jakub: If you are using XP Pro, you have to go under Explorer/ Tools/Options/View Tab, then turn off "Use Simple File Sharing" – surfasb – 2011-12-01T06:14:14.163

1

Ok so i like tomake(sic) file copyable but not deleteable. I just dont want to any1 delete my icons on desktop, but let them access to them(read and write).

Now we are getting somewhere!

My first suggestion is to create a guest account, rather than giving users you may not trust access to your account. This is because they could just change your password, and thus you are SOL.

If your account is an Admin account and not a limited user, your final result is impossible. By definition, an Admin account has full permissions to any object on the system, either explicitly or implicitly through "Take ownership".

If you insist on this route:

To protect your icons on your desktop, you'll need to go into Explorer and click your user folder. Your desktop folder should be in there. For example, look under C:\users*username*\Desktop.

Right Click, then go to Properties/Security.

Click Advanced and uncheck "inherit permissions" and in the ensuing dialog box, press Copy. This will make a copy of the existing permissions.

Next click your account name and press Change permissions.

Turn off Delete files/folders, and take ownership permissions.

Press OK. Lastly, click a check mark in "apply to Child objects".

surfasb

Posted 2011-11-29T14:54:25.697

Reputation: 21 453