Automate SUDO commands at startup e.g. for enabling WIFI
A friend of mine has a Fujitsu Siemens Amilo li 2727 laptop running Windows Vista.
I installed Ubuntu 12.4 LTS on this system, but alas, the wireless didn't work. This is the way I solved it:
Make a new textfile with these commands in it:
sudo modprobe -r ath5k
sudo modprobe acer_wmi
sudo modprobe ath5k
I gave it the name wifi-on.sh
On a Medion MD97600 laptop the commands for enabiling WIFI are a bit different: Read the original site here in French
first you should install som drivers:
sudo add-apt-repository ppa:cogito-16/ppa
sudo apt-get update
sudo apt-get install build-essential acerhk-source
sudo -s
cd /usr/src/
tar -xjvf acerhk.tar.bz2
cd modules/acerhk
make
make install
modprobe acerhk
echo 1 > /proc/driver/acerhk/wirelessled
exit
now enter these commands in a textfile
modprobe acerhk
echo 1 > /proc/driver/acerhk/wirelessled
I gave it the name wifi-on.sh
make it executable. (e.g. bij setting the rights with nautilus)
Enter ALT F2 and enter: gksu gedit /etc/sudoers and press enter.
and in the file that opens, add to the very last line (replacing "username" with your login name):
-------------------------------------------------------------------
username ALL= NOPASSWD: scriptpath
-------------------------------------------------------------------
BE SURE TO REPLACE "username" WITH YOUR LOGIN NAME.
and replace scriptpath with the path to the file you want to run without a password.
for example, I want the script to run at startup as sudo without typing in the password. The last line in my file looks like:
jeroen ALL= NOPASSWD: /home/jeroen/wifi-on.sh
where "jeroen" is my user name and "/home/jeroen/wifi-on.sh" is the script i want to run.
now save the file and close it. you are now allowed to run your script as sudo without typing in a password.
so go to system > preferences > sessions and add the command you want to run at startup under "startup programs", mine looks like:
gksu /home/jeroen/wifi-on.sh (replacing the path with the path to your script).
Reboot and configure your Wifi.
Reboot again and the machine should go online automatically. Even better than Windows Vista does.