# What's to stop somebody from creating a setuid-root script on a flash drive, then putting it into another person's computer and getting root access?

What's to stop somebody from creating a setuid-root script on a flash drive, then putting it into another person's computer and getting root access? I assume there's some kind of protection against that, but I don't have a spare drive to test with.

-
Are you just interested in scripts, as your question implies, or do you want information on similar types of apparent attacks? If just scripts, why? If not, could you please clarify your question? –  Daniel H Aug 14 '11 at 6:38

If a volume is mounted nosuid then the setuid bit is ignored on executables. At least newer versions of Fedora mount external media with this option.
… and the nosuid option would stop that binary from employing set-UID, too. –  JdeBP Aug 15 '11 at 0:50
Interpreters won't get a choice in the matter of whether a separate process is run or not if the script is executable and employs #!, by the way. –  JdeBP Aug 15 '11 at 0:55