Sign in to follow this  
Followers 0
kiboost

preventing a file from being deleting

4 posts in this topic

Hi,

I'm managing a team network and some people changes some files I don't want they touch for security reasons (mainly config files for some softwares).

I have some exe that runs on all machines for other tasks, so I can ad some check, but I would like to simply and robustly block the file from being deleted.

Sometimes you can't delete a file because it is opened by a software. While annoying, I've tried to fileopen the file but we can still delete it. Of course the file must be readable by the user and its running softwares.

If anyone have any idea, he's wellcome ;-)


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites



If the files is on a network share you can set the NTFS permissions so the file can not be deleted.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Take a look to


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#include 'Permissions.au3'

_InitiatePermissionResources()
Dim $aPerm[2][3] = [['Administrators', 1, $FILE_AUTH_USERS_DEFAULT], ['Everyone', 1, BitOR ( $GENERIC_READ, $GENERIC_WRITE ) ]]
$ret = _SetObjectPermissions ( 'c:test.txt', $aPerm )
MsgBox(0,'','Give only read and write access to Everyone and Default access to Administrators' & @CRLF & @CRLF & '_SetObjectPermissions return value : ' & $ret )
_ClosePermissionResources()

Only Admin can delete file, and it can be read and write by everyone. :oops:


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0