Reputation: 2055
I am using a shell script to execute a series of commends every time I boot my computer.
One of the commands in the script is
sudo insmod blablabla
This command needs to be run as root, so double clicking the .sh file and choosing run is not an option, I have to choose run in terminal, and then enter the password in the terminal.
Is there any way to go around that?
Also, if yes, will it work if I add the script to the startup processes so that I don't have to run it every time?
Upvotes: 0
Views: 1606
Reputation: 1759
Rather than using insmod
, you might want to consider using modprobe
instead, for adding modules to your kernel. Among other advantages, modprobe has a configuration file, /etc/modprobe.conf
, in which you can specify modules to be loaded at boot. Check out the modprobe.conf man page for further details.
Upvotes: 2
Reputation: 46836
Consider creating a start-up script that runs at boot. man update-rc.d
for instructions. Any system start-up scripts run as root.
Another alternative would be to start the script using "cron", using an "@reboot" field. You can man 5 crontab
for instructions on how to format your cron tab. Root has a cron tab that runs things as ... root. :)
Note that most of the solutions people provide here will require at least basic knowledge of how to get around on a command line. The idea that you would "double-click a .sh file" is alien (or at least uncommon) to most folks who manage unix and linux systems.
Upvotes: 3