On Sun, Mar 12, 2017 at 1:48 PM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Linux, if I call os.remove on a file which I own but don't have write > permission on, the file is still deleted: > > > py> f = open('/tmp/no-write', 'w') > py> os.path.exists('/tmp/no-write') > True > py> os.chmod('/tmp/no-write', 0) # Forbid ALL access. > py> os.remove('/tmp/no-write') > py> os.path.exists('/tmp/no-write') > False > > > It seems that os.remove on Linux will force the delete even if the file is > read-only or unreadable, provided you own the file.
In Linux, I believe you need write permission on the dir to delete a file - the perms on the file do not matter. -- https://mail.python.org/mailman/listinfo/python-list