LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why is it a bad idea to enable scripts to be run from a usb drive? (http://www.linuxquestions.org/questions/linux-newbie-8/why-is-it-a-bad-idea-to-enable-scripts-to-be-run-from-a-usb-drive-874167/)

clifford227 04-10-2011 04:40 PM

Why is it a bad idea to enable scripts to be run from a usb drive?
 
Sorry about the title, I didnt know how else to put it.

I've got a 1TB external usb hard drive, that I'd like to run some scripts from, but I think I remember reading somewhere that its not a good idea, and that that practice was actually disabled at some point in the past, I was just wondering why?

rknichols 04-10-2011 05:18 PM

The potential problem is that an external drive could contain binaries or scripts intended for a different operating system, and accidentally executing one could have unfortunate results.

For just running the occasional script, you can directly invoke the shell (or perl, or python, or whatever other interpreter the script requires) and pass it the name of the script file. As far as the OS is concerned, the interpreter is just reading that file, and execute permission is irrelevant.
Code:

bash some_script_file arg1 arg2 ...
This isn't going to work, though, if that script tries to execute other programs or scripts from that noexec file system.

MS3FGX 04-10-2011 05:19 PM

As a security measure, executable files are often disabled on removable devices. Otherwise it could be possible for a user to unknowingly run a piece of malicious software simply by plugging in a removable drive.

I am not aware of any other reason they would be blocked, though your question is somewhat vague in general (I.E. what are these "scripts" in the first place).

clifford227 04-10-2011 05:52 PM

Thanks guys,

basically the scripts I want to run just display a .jpg of a comedy programme in feh, and then have mplayer shuffle through a list of favorite comedy shows which are on the external usb drive.


All times are GMT -5. The time now is 10:02 PM.