I’m trying to run the following command without the need for sudo:
echo 1 | sudo tee -a /sys/block/$hd/device/delete
The $hd variable changes dynamically from sdb -> sdi for each one of my HDD’s in my drive bay.
I added the following line to the sudoers file:
But this didn’t make a difference its still asking for sudo password even if I run:
echo 1 | sudo tee -a /sys/block/sdb/device/delete
Put your code in a script (you ARE writing a script, right?) and grant the user
sudo access to the script.
It’ll probably end up looking something like this:
#!/bin/bash for kill_this_disk in /sys/block/sd[b-i]/device/delete do echo 1 > $kill_this_disk done
And, I hope you have good backups.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.