Abuse SUID bit to run malicious code

I was reading up on the SUID bit just there and something came to

On my own laptop, let's say I create a simple script something like:

rm /sbin/ifconfig

I then get a USB stick and format it with ext2 and I copy the script
across to the USB stick. Then I do:

sudo chown root:root /mnt/usbstick/my_script
sudo chmod 777 /mnt/usbstick/my_script
such chmod u+s,g+s /mnt/usbstick/my_script

Let's say I bring this USB stick to a computer lab. I mount the USB
stick on a workstation computer. Will I be able to run the script? If
not, why?

(I'm presuming that the script won't run. The only reason I think it
won't run is that it took me only a few seconds to come up with this
idea, and I figure the implementors of Linux are smarter than that,
but still I'd like to know the exact reason why it won't run)

I'd try this out myself for kicks but I haven't got a second computer
to play with.

Relevant Pages

  • RE: Disabling USB mass storage
    ... > registry on each to disable usb drive creation. ... As part of your script, have it report back on the status. ... customer machines, but everything we do has to be deployable on a very large ... > We tried restricting usbstor.sys through the GPO, ...
  • Re: Warning of Possible jpeg corruption [was Re: [opensuse] bash scripts from file manager in kde]
    ... Be aware that copy, or rsync, operations directly from flash memory cards through a laptop based card reader can result in jpeg ... via a card-reader and bash script. ... sync / eject before removing. ... David's Flash cards thru a reader vs Tejas's USB sticks are two different problems. ...
  • Re: USB hotplug woes
    ... The goal is that if someone where to stick in an USB flash drive, ... The script basically initializes the network, ... Further more I tried the 2.6 kernel and the machine just went nuts only ... Do you want the script to autorun whe the usb device is pluged in? ...
  • Re: [9fans] using usb
    ... Boot my plan9 today with my usb connected, ... Send 9fans mailing list submissions to ... rc word splitting trouble (erik quanstrom) ... differently depending on whether it's run in a script or a terminal. ...
    ... The script runs fine, but the resulting USB drive won't boot. ... copies the running system files into the ...