Windows server история файлов

Tracking file and folder modifications in Windows file servers holds significant importance due to several reasons. Firstly, it aids in identifying unauthorized access or alterations made to sensitive data. Secondly, it assists in troubleshooting issues related to file access and permissions. Lastly, it serves as evidence in the occurrence of a security incident.

There are various approaches to audit changes to files and folders in Windows file servers. One commonly used method involves utilizing the built-in auditing features. To implement this, it is necessary to enable auditing for the desired files and folders. Once auditing is enabled, Windows will document all access and modification events in the security event log.

Alternatively, one can opt for a third-party file auditing tool to monitor file and folder changes. These tools offer more detailed auditing information than the built-in features and enable monitoring of file access across multiple servers.

Irrespective of the chosen method, tracking file and folder modifications is vital for safeguarding data and systems. By effectively monitoring such changes, unauthorized access or alterations can be swiftly identified and addressed, problems related to file access or permissions can be troubleshooted, and evidence can be provided in the case of a security incident.

In this article we will explore both the native method for tracking modifications/changes to files and folders on File Server, and how Lepide Auditor for File Server can make the process simpler.

How to Track File and Folder Changes using Event Logs

Below is a detailed description of the procedure for tracking activities on files and folders:

  1. Open the ‘Run’ window, type ‘gpmc.msc’, and click OK
run gpmc.msc

Run ‘gpmc.msc’ on DC or workstation where Administration Tools pack installed.

  1. Right-click on a domain policy and select Edit
select Edit

  1. Double-click on ‘Audit object access’
Audit object access

Now expand as Computer Configuration → Windows Settings → Security Settings → Local Policies → Audit Policy and double-click ‘Audit object access’.

  1. Select the check-boxes Success, Failure or both (as per your auditing needs)
security policy setting

  • Audit only successful attempts – Select ‘Success’ check box
  • Audit only failed attempts – Select ‘Failure’ check box
  • To audit both success and failed attempts – Select both check boxes
  1. Right-click the folder and select Properties
select Properties

Now in Windows Explorer:

  • Select the folder on which you want to track/audit activities
  • Right click on the folder
  • Click on properties
  1. In the Properties windows click the Security tab, and then click Advanced
  1. Click the Auditing tab, and click Edit
auditing tab

In the Advanced Security Settings for dialog box, click the Auditing tab, and click Edit.

In the new dialogue box, click Add and add Everyone to the list.

Now, in the Auditing entry for window, select Full control and click OK. Finally, close all open windows by clicking OK buttons

  1. Open ‘Event Viewer’
open event viewer

Go to start menu to open ‘Event Viewer’. Once ‘Event Viewer’ opens:

Expand ‘Windows Logs’ → Select ‘Security’ → Click on ‘Filter Current Log..’

  1. Enter the event ID you want to search. Here, we are entering Event ID 4656 (the event that is generated when ‘a handle to an object was requested’).
Filter Current Log

  1. When all the events having ID are listed, double-click on any event to see its details.
event properties

Search for other relevant event IDs given below.

Limitations of Native Auditing

However, most of the time, native file server auditing just doesn’t give enough level of detail. This is because it is an entirely reactive process. For more effective file server auditing, it is important to be constantly keeping an eye on changes. This is simply not possible with native methods. Fortunately, third-party auditing solutions, like Lepide File Server Auditor, can simplify this process using intuitive UIs and user-friendly features to automate what would otherwise be very time consuming tasks.

How Lepide File Server Auditor can help you better track file and folder changes

Lepide File Server Auditor captures file/folder events in order to monitor each and every activity of users in both Windows File Servers and NetApp filers. The solution generates an “All Modifications Report” in the “Audit Reports” tab that displays detailed information about all changes (in both Grid view and Graph View) that have been made by users in file systems. Below is a screenshot with an example of the “All Modifications Report”.

Lepide File Server Change Audit

The Final Note

When it comes to native auditing, ensuring a secure IT environment directly correlates to how much time you have to perform regular auditing of your file servers. If you find that you simply don’t have the time for native auditing, or that the process is too complex, then you can always rely on solutions like Lepide File Server Auditor.

Во-первых, включите в политике аудит доступа к файлам и папкам (в разделе аудита доступа к объектам). Во вторых, в свойстах папки (в окне по кнопке Дополнительно, на вкладке Аудит) добавьте пользователей и группы, чью активность вы собираетесь отслеживать. После этого записи аудита доступа (создание и открытие файлов и папок) будут писаться в журнал событий Безопасность.
А вот как дальше обрабатывать их на python — это я вам не скажу.

а много ли файлов надо курировать? по опыту c# — есть возможность целевой подписки на события файла/папки.. и это точно легче чем журналы аудита и их парсинг..
в *икс терминологии написать демона.. и повесить где надо в шедулере.. хоть на рабочих станциях самих пользователей ))… через АД к примеру ))
если что помогу сформулировать поисковые запросы для питона ))

ps если корпоративная среда, тот же пшел достаточен:
— не надо заливать питон клиенту
— дотнет и пшел априори во всех актуальных версиях винды
— запуск стукача политиками ;)
… если что пишите, даже интересно стало ;)

Иногда бывает необходимо понять кто удалил/изменил/переименовал конкретный файл или папку. В ОС Windows для этого используется аудит доступа к объектам.

Аудит — это запись в специальные журналы информации об определенных событиях (источник, код события, успешность, объект и т.д. ). Объектом аудита может являться как любой файл или папка, так и определенное событие, например вход в систему или выход из нее, то есть можно записывать все события происходящие с конкретным файлом или папкой — чтение, запись, удаление и т.д., можно события входа в систему и т.д.

Необходимо понимать, что аудит забирает на себя.

Для того, чтобы можно было настраивать аудит файлов и папок необходимо предварительно включить эту возможность через локальные (или в случае если у Вас используется Microsoft AD групповые) политики безопасности.

В случае локальных политик необходимо запустить оснастку “Локальная политика безопасности”, для этого необходимо нажать комбинацию клавиш Win+R, в открывшееся поле ввести secpol.msc и нажать клавишу Enter.

Запуск локальной политики безопасности

В открывшейся оснастке в дереве слева необходимо перейти в раздел “Локальные политики” — “Политика аудита”.

Политика аудита

Далее необходимо выбрать необходимую нам политику — в данном случае это “Аудит доступа к объектам”. Именно этой политикой регулируется доступ к объектам файловой системы (файлам и папкам) и раскрыть ее двойным щелчком мыши. В открывшемся окне необходимо выбрать какие именно типы событий будут регистрироваться — “Успех” (разрешение на операцию получено) и/или “Отказ” — запрет операции и проставить соответствующие галочки, после чего нажать “Ок”.

Выбор политики

Теперь когда включена возможность ведения аудита интересующих нас событий и их тип можно переходить к настройке самих объектов — в нашем случае файлов и папок.

Для этого необходимо открыть свойства файла или папки, перейти на вкладку “Безопасность”, нажать “Дополнительно” и “Аудит”.

Аудит

Нажимаем “Добавить” и начинаем настраивать аудит.

Настройка аудита

Сначала выбираем субъект — это чьи действия будут аудироваться (записываться в журнал аудита).

Выбор субъекта

Можно вписать туда имя пользователя или группы, если имя заранее неизвестно, то можно воспользоваться кнопкой “Дополнительно” которая открывает форму поиска где можно выбрать интересующих нас пользователей и группы. Чтобы контролировались действия всех пользователей необходимо выбрать группу “Все”.

Пользовательские группы

Далее необходимо настроить тип аудируемых событий (Успех, Отказ, Все), также область область применения для аудита папок — только эта папка, папка с подпапками, только подпапки. только файлы и т.д., а также сами события аудита.

Для папок поля такие:

Типы событий для папок

А такие для файлов:

Типы событий для файлов

После этого начнется сбор данных аудита. Все события аудита пишутся в журнал “Безопасность”. Открыть его проще всего через оснастку “Управление компьютером” compmgmt.msc.

Сбор данных аудита

В дереве слева выбрать “Просмотр событий” — “Журналы Windows” — “Безопасность”.

Просмотр событий

Каждое событие ОС Windows имеет свой код события. Список событий достаточно обширен и доступен на сайте Microsoft либо в интернете.

Попробуем например найти событие удаления файла, для этого удалим файл на котором предварительно настроен аудит (если это не тестовые файл, то не забываем сделать его копию, так как аудит это всего лишь информация о действиях, а не разрешение/запрет этих действий). Нам нужно событие с кодом 4663 — получение доступа к объекту, у которого в поле Операции доступа Написано “DELETE” . Поиск событий в журналах Windows достаточно сложен, поэтому обычно используются специализированные средства анализа — системы мониторинга, скрипты и т.д.

Вручную можно, например, задать например такой фильтр:

Фильтры

Далее в отфильтрованных событиях необходимо найти интересующее нас по имени объекта.

Поиск нужного объекта

Открыть его двойным щелчком мыши и увидеть кто удалил данный файл в поле субъект.

Информация о файле

На этом демонстрация аудита доступа к файлам и папкам Windows на примере Windows server 2012R2 окончена. В нашей базе знаний вы найдёте ещё множество статей посвящённых различным аспектам работы в Windows, а если вы ищете надежный виртуальный сервер под управлением Windows, обратите внимания на нашу услугу — Аренда виртуального сервера Windows.

 

Still not sure how to track who deleted file/folder from windows server 2016 with audit policy? Take a look at this blog.

Here at Bobcares, we have seen several such Windows-related errors as part of our Server Management Services for web hosts and online service providers.

Today we’ll see how to track the deleted file/folder Windows.

How to track Who Deleted File/Folder from Windows Server 2016 with Audit Policy

Now let’s take a look at how our Support Engineers find who deleted the file/folder from the server.

We make use of the file system object access event auditing to identify a specific user who created, deleted, or modified a specific file.

We shall now see how to configure event auditing for files on a shared network folder on Windows Server 2016. After configuring auditing, we use the information from the Event Viewer to find the user who deleted a specific file on the file server.

However, when we delete a file from a shared network folder, it is deleted immediately instead of being sent to the user’s recycle bin.

How to Enable File and Folder Access Auditing Policy on Windows

By default, the File System Object Access audit won’t be enabled on Windows Server. We can enable and configure audit settings using Group Policy. Here are the steps that we follow to configure auditing on one server by using the Local Group Policy Editor.

    • First, we open the Local Group Policy Editor console – gpedit.msc
    • Next, we go to the GPO section with advanced audit policies: Windows Settings >> Security Settings >> Advanced Audit Policy Configuration >> Object Access
    • After that, we open the Audit File System policy and specify that we want to log only successful access events to file system objects (Configure the following audit events >> Success)
      how to track who deleted file/folder from windows server 2016 with audit policy

    • Finally, we save the changes and update the local Group Policy settings using the below command.
      gpupdate /force

Configuring File Deleted Audit Settings on a Shared Folder

Now we configure auditing in the properties of the share network folder to which we want to track access.

1. First, we run File Explorer and open the folder properties. We go to the Security tab and click the Advanced button. Then we go to the Auditing tab.

2. If the message below message appears, click the Continue button.

You must be an administrator or have been given the appropriate privileges to view the audit properties of this object

3. Then we click the Add button to specify the user or group for which we want to capture audit events. If we want to track access events for all users, we do specify the Everyone group.

4. After that, we also specify which permissions used to access the object should be logged. To save only file deletion events in the Event Log, we click the Show advanced permissions button. In the event list, we leave auditing only for the folder and file deletion events – Delete and Delete subfolders and files.

In case, the user deletes any file or folder in the shared network folder. Then the File System -> Audit Success file delete event appears in the Security log with Event ID 4663 from the Microsoft Windows security auditing source.

Then we open the Event Viewer MMC console (eventvwr.msc), expand the Windows Logs -> Security section. Enable event log filter by the EventID 4663.

After that, we open any of the remaining events in the Event Viewer. We see that it contains information about the name of the deleted file, the account of the user who deleted the file, and the process name.

An attempt was made to access an object.
Subject:Security ID: CORP\jon
Account Name: jon
Account Domain: CORP
Logon ID: 0x32B12627
Object:Object Server: Security
Object Type: File
Object Name: E:\Distr\Backup.rar
Handle ID: 0x7bc4
Resource Attributes: S:AI
Process Information:
Process ID: 0x4
Process Name:
Access Request Information:
Accesses: DELETE
Access Mask: 0x10000

After enabling file access auditing policy, we can find the below details in the Security log:

  • Who deleted the file from the shared network folder and when it happened
  • What application (process) was used to delete the file
  • What is the date of the backup to be restored

How to Write File Deletion Events to SQL Database (MySQL/MSSQL)

However, even if the audit of the deleted files is enabled, it can be troublesome to find something in the logs. Firstly, it is quite hard to find a specific entry among thousands of events. Secondly, if a file was deleted a long time ago, this event may be absent in the logs, since it was overwritten by new events.

We save all file delete events to the SQL database. For that, we use Microsoft SQL Server, Elasticsearch, or MySQL/MariaDB databases to store the events.

For example, let’s see how to log audit events to a separate database table on MySQL. We can use the following table format:

  • Server name
  • Name of the deleted file
  • Date and time
  • Name of the user who has deleted the file

The MySQL query to create this table looks like below:

CREATE TABLE deleted_items (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), file_name VARCHAR(255), dt_time DATETIME, user_name VARCHAR(100), PRIMARY KEY (ID));

To get events with EventID 4663 from the Security log for the current day, we use the following PowerShell script:

$today = get-date -DisplayHint date -UFormat %Y-%m-%d
Get-WinEvent -FilterHashTable @{LogName=”Security”;starttime=”$today”;id=4663} | Foreach {
$event = [xml]$_.ToXml()
if($event)
{
$Time = Get-Date $_.TimeCreated -UFormat “%Y-%m-%d %H:%M:%S”
$File = $event.Event.EventData.Data[6].”#text”
$User = $event.Event.EventData.Data[1].”#text”
$Computer = $event.Event.System.computer
}
}

The next PowerShell script will write the data we get to the MySQL database on a remote server (with the IP address 10.1.1.13):

Add-Type –Path ‘C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.8\Assemblies\v4.5\MySql.Data.dll’
$Connection = [MySql.Data.MySqlClient.MySqlConnection]@{ConnectionString=’server=10.1.1.13;uid=posh;pwd=P@ssw0rd;database=aduser’}
$Connection.Open()
$sql = New-Object MySql.Data.MySqlClient.MySqlCommand
$sql.Connection = $Connection
$today = get-date -DisplayHint date -UFormat %Y-%m-%d
Get-WinEvent -FilterHashTable @{LogName=”Security”;starttime=”$today”;id=4663} | Foreach {
$event = [xml]$_.ToXml()
if($event)
{
$Time = Get-Date $_.TimeCreated -UFormat “%Y-%m-%d %H:%M:%S”
$File = $event.Event.EventData.Data[6].”#text”
$File = $File.Replace(‘\’,’|’)
$User = $event.Event.EventData.Data[1].”#text”
$Computer = $event.Event.System.computer
$sql.CommandText = “INSERT INTO deleted_items (server,file_name,dt_time,user_name ) VALUES (‘$Computer’,’$File’,’$Time’,’$User’)”
$sql.ExecuteNonQuery()
}
}
$Reader.Close()
$Connection.Close()

After saving events to an external database, we can clear this Event log.

Now, to find out who has deleted the file “AnnualReport.DOC“, we run the below script in the PowerShell console.

$DeletedFile = “%AnnualReport.DOC%”
Set-ExecutionPolicy RemoteSigned
Add-Type –Path ‘C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.8\Assemblies\v4.5\MySql.Data.dll’
$Connection = [MySql.Data.MySqlClient.MySqlConnection]@{ConnectionString=’server=10.1.1.13;uid=posh;pwd=P@ssw0rd;database=aduser’}
$Connection.Open()
$MYSQLCommand = New-Object MySql.Data.MySqlClient.MySqlCommand
$MYSQLDataAdapter = New-Object MySql.Data.MySqlClient.MySqlDataAdapter
$MYSQLDataSet = New-Object System.Data.DataSet
$MYSQLCommand.Connection=$Connection
$MYSQLCommand.CommandText=”SELECT user_name,dt_time from deleted_items where file_name LIKE ‘$DeletedFile'”
$MYSQLDataAdapter.SelectCommand=$MYSQLCommand
$NumberOfDataSets=$MYSQLDataAdapter.Fill($MYSQLDataSet, “data”)
foreach($DataSet in $MYSQLDataSet.tables[0])
{
write-host “User:” $DataSet.user_name “at:” $DataSet.dt_time
}
$Connection.Close()

Finally, now, we see the username and the time the file was deleted in the PS console.

Logging File Delete Audit Events to a Text File

If we don’t want to use a separate database server, we save file deletion audit events to a plain text log file. For that, we use this PowerShell script to save the output to a text file:

$Outfile = “C:\Logs\Deleted-file-history-log.txt”
$today = get-date -DisplayHint date -UFormat %Y-%m-%d
Get-WinEvent -FilterHashTable @{LogName=”Security”;starttime=”$today”;id=4663} | Foreach {
$event = [xml]$_.ToXml()
if($event)
{
$Time = Get-Date $_.TimeCreated -UFormat “%Y-%m-%d %H:%M:%S”
$File = $event.Event.EventData.Data[6].”#text”
$User = $event.Event.EventData.Data[1].”#text”
$strLog = $Computer + ” ” + $File + ” ” + $Time + ” ” + $User
$strLog | out-file $Outfile –append
}
}

[Need any further assistance in tracking the file/folder deletion queries? – We are here to help you]

Conclusion

Today, we saw how our Support Engineers find out who deleted the file/folder in the Windows server.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как настроить пользовательский интерфейс windows кратко
  • Как изменить пароль аккаунта windows
  • Как очистить windows 10 до первоначального состояния
  • Для чего служит реестр операционной системы windows
  • Microsoft video for windows sdk