I want to run wondershaper at startup but it requires that I run it as sudo. So how would I go about having the command run at startup?
ie. sudo wondershaper eth1 x x
Printable View
I want to run wondershaper at startup but it requires that I run it as sudo. So how would I go about having the command run at startup?
ie. sudo wondershaper eth1 x x
Add the command to /etc/rc.local
Go to your terminal and type sudo visudo. A text file will pop out in your terminal, go to the line where's
in ubuntu under 'root ALL=(ALL) ALL' there should be a line like 'user.name ALL=(ALL) ALL' probably looking like thisCode:root ALL=(ALL) ALL
anyway under the line 'root ALL=(ALL) ALL' you should write a line that would look like thisCode:root ALL=(ALL) ALL
user.name ALL=(ALL) ALL
where user.name it's the name u are using to log in. After editind press F2 and enter to confirm saving. What this will do it's that when you will use sudo no password will be required and this will help you to run that program of yours at startup.Code:root ALL=(ALL) ALL
user.name ALL=NOPASSWD: /path_to_your_program_bin_file
!!! I've modified my post 'cause I have to agree it's not safe to advise anybody to do that. So the proper way to do this would be "user.name ALL=NOPASSWD: /path_to_your_program_bin_file" so only that program could be executed with sudo without the use of a password. Sorry for doing a post that could had endangered your PC especially if you're connected at a local network> I didn't thought much at that moment 'cause I have this bad habit to believe most people have the same Internet connection as I do, the same PC configurations and so on, though I know this it's impossible that's my first impressiom he he :-) Cheers
Look into changing the permissions on the executable. Applications should not be running as root, however you can create a special user that has the permissions required for the application. Look through the /etc/passwd file and you'll see many "users" with specific permission sets. That's the way we do it.
Having said that, I do run some applications as root, but I understand that if I were doing it right, I would never have to.
Yes, it will. Preferable solution is to add the command to /etc/rc.local, just in front of the line in that file that reads "exit 0" and without the "sudo" at the front. The rc.local file runs at boot time, as root. Also, if the program is not in the "usual" program locations known to the boot process, it will need its full pathname rather than just "wondershaper" so that the process can find it.
Since I had no idea what wondershapper was I googled it and it sent me back here:
http://ubuntuforums.org/showthread.php?t=25911
See if that makes any sense.
If not and since this is a networking application you might consider creating a script and adding it to:
Any script added to that directory will be run (by root so you don't need the "sudo" part) only after the network is up.Code:/etc/network/if-up.d
+1
This seems like the best solution to me and it'll work.
Don't change permissions as indicated earlier.
If you want to run an sudo command at startup use crontab. This would run RKHunter.
sudo crontab -e
@reboot /usr/bin/sudo rkhunter -c -sk
Here's an excellent crontab guide.
https://help.ubuntu.com/community/CronHowto