I noticed that most of my image files are green when the ls command is used but some of them look purple. Apparently .png and .jpg files are supposed to look Magenta while executable files are Green.

But when making a Beamer presentation only the 'executable images' work.

Why are my PNGs executable?

I am using Ubuntu on the WSL.

I get the following error on non-executable images. Would this be a Latex error?

~/LatexFiles/images/LSTM-falsepositive-DRTHIS.png: Permission denied

LaTeX Warning: File `LSTM-falsepositive-DRTHIS.png' not found on input line 32.

! Package pdftex.def Error: File `LSTM-falsepositive-DRTHIS.png' not found: usi
ng draft setting.

The stat command gives this output:

  File: images/LSTM-falsepositive-DRTHIS.png
  Size: 90023           Blocks: 176        IO Block: 4096   regular file
Device: 2h/2d   Inode: 5348024557507288  Links: 1
Access: (0000/----------)  Uid: ( 1000/  marcus)   Gid: ( 1000/  marcus)
Access: 2020-02-25 10:56:13.114775800 +0000
Modify: 2020-02-25 10:56:13.114775800 +0000
Change: 2020-02-25 11:10:56.091436300 +0000
 Birth: -
  • 4
    where did they come from? VFAT partitions often show all files as executable; it depends on the mount options.
    – ilkkachu
    Feb 25 '20 at 13:51
  • 2
    color schemes may differ depending on distro and terminal configurations and environment variables. check ls -l file, lsattr file, stat file, etc. for specific properties... understand what is going on before making changes Feb 25 '20 at 14:02
  • 3
    Your stat update shows that the file has no read, no write, and no execute permissions. The problem with pngs "working" is more likely due to it having no read permission than no execute permission. Feb 25 '20 at 14:28
  • 2
    Ok. An access value of 0000, or --------- means "no none, not even the owner, may read, write, or execute this file". This is usually not what anyone would want. Do you know where these files came from, and if someone or a script has maybe made a mistake in manipulating the access attributes?
    – AdminBee
    Feb 25 '20 at 14:29
  • 1
    Since the files have indeed "zero permissions", @MarkSteward's answer should set the permissions to a more useful "read/write for owner, read only for everyone else". You can apply this to all PNG files in the directory using chmod 644 *.png (which you probably know already).
    – AdminBee
    Feb 25 '20 at 15:08

Any file can be tagged as executable.

chmod 644 filename.jpg

will remove the execute. This will give rw to owner, read to everyone else and remove execute. Make sure that is what you want.

Added from good comment below: use chmod -x filename.jpg it will clear the execute bits without changing other settings.

  • 1
    OP edited and added comment that only executable images work, please explain? Feb 25 '20 at 14:00
  • 6
    chmod -x will clear the execute bits regardless of the file's current permissions. chmod 644 will remove any execute bits, but may also change other permissions. Feb 25 '20 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.