shanenin Posted September 14, 2005 Report Share Posted September 14, 2005 (edited) I was reading this post on an other forumI need to create a shell script that controls the users runlevel at every startup/logon of the linux system. the user should be prompted with a menu screen taht asks for their desired runlevel. The user should be presented with the following 3 choices:¤ Single User Mode¤ Full/Extended Multi-User Mode¤ Graphical/XII ModeThe user should be "started up" in any one of these modes based on their "numerical" reponse. In addition there are certain runlevels that shouldn't be used. the script should also provide for the condition that the user might "erroneously" respond with these unsafe runlevels. In such cases the script should prevent the system from entering these runlevels & instead give a message like "Invalid Choice, Try Again!"here is my understaning of the boot process. The first program ran is init. Init first reads /etc/inittab to determine what runlevel to use. To make this script he wants to work, wouldn't you have to change the whole way the system boots, this seems like a tough thing to do. Wouldn't init have to ignore /etc/inittab, then instaed follow this "shell script" to tell it what runlevel to start. For this to work, would you have to rewrite the init program? Edited September 14, 2005 by shanenin Quote Link to post Share on other sites
jcl Posted September 14, 2005 Report Share Posted September 14, 2005 (edited) Seems kinda pointless. It's easy to switch runlevels and difficult to imagine why you would want to at every login. But I'm sure you could fiddle with inittab &c and make it work. Edited September 14, 2005 by jcl Quote Link to post Share on other sites
iccaros Posted September 14, 2005 Report Share Posted September 14, 2005 (edited) well, the first program ran is the boot loader.. the person does not need a script.. Grub and LILO can pass init levels to the systems. on Gentoo you can do this with RC http://gentoo-wiki.com/Rc. I have mine with 4 choices.. boot with X11 normal ethernet, boot no ethernet with GUI, boot wireless with GUI, boot no GUI no ethernet (command line)these all become options in side of GRUB..here is a good PDF on protecting your linux system from access in single user mode (no user should ever..ever..ever be given single user mode access. )http://www.elxlinux.com/images/PDFS/grub_thesis-3.pdfa script would also be easy and ran from your bash.rc file. it would give them a choice of level and then sudo int $. but that would need work to keep you from being in a endless loop of asking what to do..add------------------------or if you start at say init level 4 and put the call to the script in int 4 section of the inittab you would eleminate the possability of looping scripts.. Edited September 14, 2005 by iccaros Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.