Use truncate --no-create --size=0 to truncate files This avoids the permission error due to /proc/sys/fs/protected_regular = 2 setting which is now enabled by default in kali-rolling.
Raphaƫl Hertzog
3 years ago
1 changed file(s) with
1 addition(s)
and
1 deletion(s)
.
Raw diff
Collapse all
Expand all
+1
-1
share/hooks/normal/0140-remove-log-files.hook.chroot
less
more
4
4
# Truncate log files
5
5
for _FILE in $(find /var/log/ -type f)
6
6
do
7
: > ${_FILE}
7
truncate --no-create --size=0 ${_FILE}
8
8
done