Originally posted by fingermouth
My problem is when i run the script, i get an error saying log in as root.
Typically you don't log in as root to do this sort of stuff. Just log in with your usual username, then run the script from the terminal, but first type in the "su" command (and then the root password). This will make all following commands executed from that terminal window run as root.
Oh, btw, X should not be running when you execute the file, so make sure you are in runlevel 3 (/sbin/telinit 3 while in su will set the runlevel to 3). I suggest you edit the /etc/inittab file and set the startup runlevel to 3, in case there are any problems. Use the command "startx" to enter X from runlevel 3.