0

I'm trying to understand what the noexec flag actually accomplishes. Does it prevent all executions originating from that file system? Or is it only ones that aren't in the bin folder?

In addition, let's say I manage to set exec as the default flag for all drives. Is there actually a risk that I could plug in a USB and it would automatically execute malicious code? Is this what noexec exists for, or is it only there to prevent users from doing stupid things with random executables?

This is different from the suggested duplicate as the duplicate does not explain whether there are security vulnerabilities associated with this practice.

Michael Kolber
  • 377
  • 2
  • 4
  • 15

1 Answers1

0

If you check the fstab page:

exec / noexec:

exec lets you execute binaries that are on that partition, whereas noexec does not let you do that. noexec might be useful for a partition that contains no binaries, like /var, or contains binaries you do not want to execute on your system, or that cannot even be executed on your system, as might be the case of a Windows partition.

It prevents executions if you´re not an authorized user. If you put exec by default a USb will be able to run something (from the mounted media) but only with it´s current user rights.

hackela
  • 133
  • 7
  • Where would I be able to find the fstab page? I'm new at this and appreciate the help. Also, `current user rights`: Does this mean the user that is logged in when the USB is plugged in? – Michael Kolber Oct 26 '17 at 20:10
  • Sounds like they mean the man page, like manual pages. Almost every command has one, or see `man man` for general info. My `man fstab` doesn't mention noexec, but my `man mount` page does, so look there too. – Xen2050 Oct 26 '17 at 20:32
  • Your´re right. I checked again and found that complete topic about it. You have much more details than what I did: [link to complete details](https://unix.stackexchange.com/questions/161999/how-does-fstab-exec-noexec-parameter-affects-samba-shares). I hope it will help. – hackela Oct 26 '17 at 22:05