---
title: "File nào cần xóa sau khi cài xong"
url: https://phatdev.net/docs/sl-migrations/which-files-need-to-be-removed-after-an-install
lang: vi
updated: 2026-10-20
alternate:
  en: https://phatdev.net/en/docs/sl-migrations/which-files-need-to-be-removed-after-an-install
markdown: https://phatdev.net/docs/sl-migrations/which-files-need-to-be-removed-after-an-install.md
---

# File nào cần xóa sau khi cài xong

Thuộc bộ tài liệu: [SL Migrations](https://phatdev.net/docs/sl-migrations.md)

> Danh sách các file installer để lại - phải xóa để bảo mật.

## File cần xóa sau khi cài xong

Lưu ý: **Quan trọng** - không xóa các file này = lộ database credentials và mở cửa cho attacker.

## Auto cleanup

SL Migrations tự xóa các file sau khi step 4 thành công:

- `installer.php`
- `installer-backup.php`
- Folder `slm-installer/` (toàn bộ)
- `dup-archive__*.txt`, `.daf`, `.zip`
- `dup-database__*.sql`, `.sql.gz`
- `dup-params__*.json`
- `slm-installer-csrf__*.txt`
- `slm-installer-log__*.txt`
- `slm-installer-data__*.sql`

## Verify thủ công

Sau khi cài xong, kiểm tra web root (qua FTP, cPanel File Manager, hoặc SSH). Nếu còn file installer hoặc file có prefix `dup-` hay `slm-installer` → xóa ngay.

## Tại sao nguy hiểm

Mỗi file chứa loại dữ liệu nhạy cảm khác nhau:

| File | Chứa gì |
|---|---|
| `installer.php` | Script chạy SQL/file write - attacker có thể tái sử dụng |
| `dup-params__*.json` | Database credentials dạng plaintext |
| `slm-installer-csrf__*.txt` | Mật khẩu archive + CSRF tokens |
| `dup-database__*.sql` | Full database dump - gồm password hash users |
| Archive file | Snapshot toàn bộ site nguồn |

Nếu attacker đoán được URL (qua brute force hash) → đọc file qua HTTP → lấy database credentials → take over site.

## Phòng tránh

1. **Đặt rule chặn truy cập file installer ở tầng web server**. Ví dụ với Nginx:

   ```
   location ~* /(installer\.php|dup-.+\.(txt|json|sql|log)|slm-installer-.+\.txt) {
       deny all;
       return 404;
   }
   ```

   Với Apache, dùng `.htaccess`:
   ```
   <FilesMatch "^(dup-.+\.(txt|json|sql|log)|slm-installer-.+\.txt)$">
       Require all denied
   </FilesMatch>
   ```

2. Verify rule hoạt động: truy cập một URL bất kỳ kiểu `https://example.com/dup-params__test.json` → phải trả về 404.

3. Sau mỗi lần install, dành 1 phút kiểm tra file còn sót.

## Tham khảo

- [Quick Start](https://phatdev.net/docs/sl-migrations/quick-start)
- [Khắc phục permission](https://phatdev.net/docs/sl-migrations/how-to-fix-file-permissions-issues)
