{{Header}}
{{Title
|title=umask
}}
{{#seo:
|description=This article explains how umask hardening can cause file permission issues when copying files, with step-by-step instructions to reproduce and resolve the problem.
|image=Umask-clipart.svg
}}
[[File:Umask-clipart.svg|thumb]]
{{intro|
Due to the [[Dev/Strong_Linux_User_Account_Isolation#umask_hardening|umask hardening]] security feature, a usability issue may arise where file permissions are more restrictive than expected.
This guide demonstrates how to reproduce the issue and provides solutions to mitigate it.
}}
= Explanation =
This behavior occurs because the file <code>testfile</code> was initially created with restrictive permissions, making it unreadable by "others". When the file is copied, those permissions are preserved by default.
The <code>cp</code> command retains the original file's mode (permissions) unless otherwise instructed. To prevent this, use the <code>--no-preserve=mode</code> option.
= Solutions =
Use <code>cp</code> with the <code>--no-preserve=mode</code> option to avoid inheriting the original permissions.