Chaining Abuse
- Category
- Tool Misuse
- Confidence
- 83% confidence
- Finding
The pipeline
echo ... | sudo tee -a /etc/fstabis a form of shell chaining that performs a privileged write to a boot-critical file. Even though the inserted string is constant here, this pattern is fragile, easy to reuse unsafely later, and can create duplicate or invalid entries that risk boot failure or broken mounts.- Content
md 2. Kiểm tra đã có dòng `/swapfile` chưa (tránh trùng): `grep -nE '^[^#]*swap' /etc/fstab` 3. Chỉ append nếu CHƯA có: `echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab` 4. **VALIDATE trước khi reboot — BẮT BUỘC:** `sudo findmnt --verify --verbose` (hoặc `sudo mount -a` — lỗi thì DỪNG và khôi phục backup) `sudo swapon -a` để chắc chắn nạp lại không lỗi.
