Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
02-18-2006, 01:08 AM
|
#1
|
LQ Newbie
Registered: Dec 2003
Posts: 10
Rep:
|
Different Users Booting into Different runlevels
I have two users on my slack, say consUser and guiUser. Any suggestions on what I can do to let consUser boot to runlevel 3 by default and guiUser boot to runlevel 4 by default?
|
|
|
02-18-2006, 02:00 AM
|
#2
|
Member
Registered: Nov 2005
Location: Columbus, OH, USA
Distribution: Slackware
Posts: 246
Rep:
|
The runlevel is not user-specific. Init is the first process started by the kernel and will run into whatever level is specified in /etc/inittab. I think the best thing you could do is make an entry into guiUsers's ~/.bash_profile along the lines of /usr/X11R6/bin/startx. That should run X when they log in at the CLI.
Disclaimer: I've never tried this.
|
|
|
02-18-2006, 02:26 AM
|
#3
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141
Rep:
|
What you've suggested works odevans. I've used the following to give users a choice if they log in on tty1:
Code:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
echo -n "Start the GUI? (y/n): "
read ANSWER
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ]; then
startx
fi
fi
|
|
|
02-18-2006, 03:27 AM
|
#4
|
Member
Registered: Nov 2005
Location: Columbus, OH, USA
Distribution: Slackware
Posts: 246
Rep:
|
And, if you do have your machine boot into runlevel 4, there is still a text login available by hitting Ctrl+Alt+F6 (Alt+F7 to return to GUI).
|
|
|
02-18-2006, 06:10 PM
|
#5
|
Senior Member
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482
|
Quote:
I have two users on my slack, say consUser and guiUser. Any suggestions on what I can do to let consUser boot to runlevel 3 by default and guiUser boot to runlevel 4 by default?
|
You could configure your boot loader to provide two different boot options. As a basic practice I always configure GRUB to provide both a runlevel 3 and runlevel 4 boot option. My default is runlevel 4, but often I manually select runlevel 3 when I want to tinker or troubleshoot. If you configured your boot loader similarly, then one user must manually select the boot option, but I suspect the console user won't mind doing that . See if the following helps:
Configuring Slackware for a GUI and a Command Line Startup
Another option, if the guiUser is not totally adverse to a command line login, is to modify the login and startx scripts. Modify the login script to prompt the user whether or not to launch X. With some additional modifications, you could automate launching X based upon a config file and user name. See if the following helps:
A More Aesthetic Runlevel 3 Login Screen
A More "Intelligent" startx Script
Of course, by design GNU/Linux is a multi-user operating system. Thus, even if guiUser starts the box in GUI mode, consUser can easily toggle to a different virtual console. KDE nowadays now nicely supports switching users in addition to the basics of switching virtual terminals.
I hope this helps.
|
|
|
02-20-2006, 08:10 AM
|
#6
|
LQ Newbie
Registered: Dec 2003
Posts: 10
Original Poster
Rep:
|
Thanks all for the replies. I don't have access to my slack box now, but I'll try something when I get the chance to.
About the boot loader, well that would seem to be one of the best option, but I think my guiUser would probably prefer something that works straight off when the power switch is pressed. But I do admit that is one of the best alternatives.
Going default runlevel 4 is also good, but I am the main user of the box. So I am actually too lazy to switch to a console login everytime I use it. guiUser only uses it occasionally when her windows box is fried for some reason.
The other one would be to let guiUser's startup script run startx. But the next problem would be to shutdown elegantly. I'm using xfce and I can't figure out how to run the sudo halt command with the click of a button.
|
|
|
02-20-2006, 08:16 AM
|
#7
|
Senior Member
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649
Rep:
|
Woodsmans idea is great.
But also, if you set /etc/initab to always boot level 4, on the login screen there is a options button. Click that, and it has a console login option
(At least, if you use the KDE GUI login)
Personally, I use grub with the init 3 and init 4 options selectable (As Woodsman showed),with the default being console in 5 seconds.
Last edited by cwwilson721; 02-20-2006 at 08:17 AM.
|
|
|
02-21-2006, 09:57 PM
|
#8
|
Senior Member
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482
|
Quote:
but I am the main user of the box
|
Then pragmatically, configure your boot loader to boot into runlevel 3 as the default boot action.
Quote:
guiUser only uses it occasionally when her windows box is fried for some reason
|
Then, as the occasional user, that is---the exception to the norm---guiUser should be expected to be the one who has to manually select the correct boot loader option.
Create the two boot loader options as mentioned above, and "train" guiUser how to manually move the keyboard down arrow key to select the second alternate option and press the Enter key.
Quote:
I'm using xfce and I can't figure out how to run the sudo halt command with the click of a button.
|
Since you have mentioned that guiUser is a Windows user, consider installing KDE and when guiUser uses the box, based upon manually selecting the correct boot loader option, allow the box to automatically boot directly into KDE and the KDE Display Manager (login manager). guiUser will need to configure KDE as her default X environment.
Then configure the KDE Login Manager (performed from within the KDE Control Center) to allow all users to shutdown the box (this is the default action BTW). When guiUser attempts to log off, and because KDE was launched from runlevel 4, the KDE login manager will provide an option to automatically shut down. The nice thing about this option is you need not mess with sudo. And KDE provides a GUI very similar to Windows.
See if the following helps:
Shutdown As a Normal User With KDE
KDE supports the multi-user environment and allows concurrent user sessions. So if guiUser has booted the box and is already using KDE, but you want to use the box and not end her KDE session, you can toggle to the KDE login manager, log in, and select a different GUI such as XFCE, or simply login at the console, or toggle to a non-GUI virtual console (Ctrl-Alt-F6).
You also can configure the KDE login manager to automatically login guiUser.
|
|
|
02-21-2006, 10:04 PM
|
#9
|
Member
Registered: Nov 2005
Location: Columbus, OH, USA
Distribution: Slackware
Posts: 246
Rep:
|
Quote:
Originally Posted by s4006576
I'm using xfce and I can't figure out how to run the sudo halt command with the click of a button.
|
From the xfce FAQ:
15. How do I enable the shutdown/reboot action in the session-manager logout dialog?
You have to allow the user(s) to execute $installdir/libexec/xfsm-shutdown-helper with sudo. Please install sudo, and refer to xfce4-session and sudo documentation.
You need sudo installed. You edit the sudoers file as root with visudo. This is how the entry looks on my slack box that runs xfce:
Code:
%users ALL=NOPASSWD:/usr/libexec/xfsm-shutdown-helper
Last edited by odevans; 02-21-2006 at 10:05 PM.
|
|
|
02-24-2006, 09:46 PM
|
#10
|
LQ Newbie
Registered: Dec 2003
Posts: 10
Original Poster
Rep:
|
Got a chance to play with my slack at last...
odevans: the method only applies if you boot at runlevel 4 I think...I tried but it did not seem to make any difference to my xfce logout
I figured out a way to do what I wanted at last. Using the bash_profile script above that runs X on login, I just added '&& sudo halt' to the end. This will run sudo when startx is done, which is when the user logouts. Thanks all for your help.
|
|
|
All times are GMT -5. The time now is 09:45 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|