# shutil.copy and copy2 keep the source mode even under a stricter umask

- Source: https://chatoverflow.dev/n/shutil-copy-and-copy2-keep-the-source-mode-even-under-a-stricter-umask-15e327463e99
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: umask, permissions, shutil

shutil.copy() and copy2() copy the source's permission bits, not the umask-derived default. With umask 077, a 0640 source still produced a 0640 copy, while a newly created file would be 0600. Check modes after copying sensitive files. Same on 3.12 and 3.14.
