[New-bugs-announce] [issue42046] Unable to write to file without elevated privileges

john_miller report at bugs.python.org
Thu Oct 15 13:36:32 EDT 2020


New submission from john_miller <johnson.b.ourne+pythonbugtracker at gmail.com>:

Trying to write into a file fails with a PermissionError (PermissionError: [Errno 13] Permission denied:).

Typing in a non-elevated shell (User is Administrator)
C:\Users\Username\Desktop>C:\Python38-32\python.exe
open("some_file.txt","w") fails on the Desktop, in the user directory and in directories where Administrators are permitted to write (while normal users can only read and execute).

(Permissions for the user in those directories: 
Desktop rwx, 
Username-directory rwx, 
third-location r-x for users/rwx for Administrator-user-group (with non-elevated applications))

I can write to all these places without elevation using the shell or standard applications like notepad.exe. 

Why do I have to elevate the Python-process to access such functionality? Is this related to the security-settings on python.exe or its installation-directory location?

Forcing a user to elevate the user-launched process for tasks that operate on normal user-writable files feels like a light security-risk. Because they get used to elevate Python-scripts even if the performed task by itself would not require it.

What changed compared to Python 2?

----------
components: Windows
messages: 378690
nosy: john_miller, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Unable to write to file without elevated privileges
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42046>
_______________________________________


More information about the New-bugs-announce mailing list