Set umask on swapfile creation (#2436)

Make sure the swapfile is only readable by the owner.
This commit is contained in:
Stefan Agner 2023-03-28 18:18:58 +02:00 committed by GitHub
parent 1edb5c8c9e
commit 399997e83c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@ if [ ! -s "${swapfile}" ] || [ "$(stat "${swapfile}" -c '%s')" -lt $((swapsize *
fi
echo "[INFO] Creating swapfile of size $((swapsize *4))k"
umask 0077
dd if=/dev/zero of="${swapfile}" bs=4k count="${swapsize}"
fi