Linux is a very secure operating system because it does not allow any random application to take control of your computer. Instead it tends to give YOU the power to micro-manage which programs are to be run. It will ask you for the root password before it lets you do any systems-level operation.
But sometimes we do have certain applications, daemons, scripts, etc., that we want to run at machine startup. Some of these programs might require you to type in root password before running them.
So, how to run these root programs at startup without the pains of entering your password at boot-up every time?
There are several ways but I will mention only the two easiest. Read on..
The file sudoers can be used to allow you to run a root program like "sudo netstat" but will not ask for a password. The file is /etc/sudoers. You can edit this file with command: sudo gedit /etc/sudoers. Add this line to the file: username ALL=(root) NOPASSWD: /path/to/your/program Here username should be your user name and /path/to/your/program is the complete path of whatever you don't want type password for. Now, add a new entry to Startup Applications tool like sudo /path/to/your/program. Now reboot and your program will autorun without asking for any password!
Another method is to add your program to crontab. This is very simple. Just run sudo crontab -e. This will open a file in vi editor. Just add this line to the file: @reboot /path/to/your/program like above. The CRON tool will autostart your program with root privileges on every boot up.
0 comments:
Post a Comment