You are not logged in.

#1 2021-10-06 18:27:03

Martin
Member
From: Stockholm, Sweden
Registered: 2015-10-01
Posts: 581
Website

Why do so many files have permission to be executed?

This is my current head-scratcher: Tons of files (.txt, .org, .pdf, .jpg, etc) on my computer have been created with execution permission set. How come? I can see how this can be the case for files I down-load such as podcasts but why files created on my computer? I don't see a clear pattern either, like all PDFs created by LibreOffice or so. It is kind of random but the population with permission to be executed is dominating.

Why am I bothered? Well, mostly not but it does throw a spanner into the works of programs that colour-code file listings based on type of file. I am thinking of ranger and mc as examples.

Anyone with an idea for a script that finds and de-activates execution permission for all files with a prescribed name pattern?

/Martin


"Problems worthy of attack
prove their worth by hitting back."
Piet Hein

Offline

#2 2021-10-07 14:05:28

twoion
一期一会
Registered: 2015-08-10
Posts: 3,357

Re: Why do so many files have permission to be executed?

Hm, maybe a tool is going rogue. Perhaps check umask of tools like firefox?

Anyhow, very simple:

find /path/to/search -type f -executable

To these, you can add

-iname
-iregex

to filter by name and many more filters. Filters are ANDed by default, though you can also use -or, ! for inversion and brackets for grouping with find's filters.

Online

Board footer

Powered by FluxBB