LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   autologin as root in multiple distro's (https://www.linuxquestions.org/questions/linux-newbie-8/autologin-as-root-in-multiple-distros-112311/)

ewa8949 11-04-2003 12:16 PM

autologin as root in multiple distro's
 
I am posting this to the newbie section since I am new to Linux. Although I have almost completed reading a Linux book I can't quite figure out how to get started on my problem.

I need to write a script/program to test out a program my company is developing in Linux. When complete, the program will reboot the system. I need to stress test the program by running it, rebooting the system, running the program again and checking status. This has to support multiple linux distributions but not necessarily the GUI managers (KDE, gnome) since the program will have a silent command line option but it would be nice if i could autologin into KDE or Gnome and run the script.

Because of the memory locations the program accesses I need to run it as root. How can I setup multiple distributions of Linux so that it boots, runs the program as root, and then reboots and does the same thing over again? I need to do this for Red hat 9.0 and Suse 8.2 at the very least.

Thanks!
Eric

ToniT 11-04-2003 12:28 PM

Put the program to the end of the /etc/rc.local.

ewa8949 11-04-2003 12:54 PM

Thanks! This is exactly what I needed to get started. I tired this out with a simple cat /etc/rc.local > test.txt and it seems to be working. The program that I need to run and test out uses a linux driver to write to a restricted memory location which requires the user to be logged in as root. Does this run it as root or is there a way to use su and have it put in the root password automatically?

Thanks,
Eric

ToniT 11-04-2003 12:59 PM

The /etc/rc.local script is run as a root uid at the end of the boot sequence. If you need to do something as a different user, you can use su to change yourself to somebody else (su doesn't need password if you transform from root to otheruser (but the opposite is not true, of course)).


All times are GMT -5. The time now is 06:18 PM.