unmount device after startup as root ?

2 2036
I would like to unmount a device after the startup.
I've already made a Shell-Script which unmounts the device after startup, but only when you are root.

  1. #! /bin/sh
  2. sudo umount /dev/...
Copy the Code

How do I give users rigths for executing the Shell-Script as root?
Or can I put the root password inside the Shell-Script?
Edit /etc/rc.local, and before it says "exit 0" put /path/to/ &
It will then be run as root

If it doesn't work, try reading this:

Didn't worked for me. Changed the sudoers file and added /bin/umount for my user to execute the file as root

You have to log in before you can reply Login | Sign Up

Points Rules