LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-18-2006, 12:08 AM   #1
s4006576
LQ Newbie
 
Registered: Dec 2003
Posts: 10

Rep: Reputation: 0
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?
 
Old 02-18-2006, 01:00 AM   #2
odevans
Member
 
Registered: Nov 2005
Location: Columbus, OH, USA
Distribution: Slackware
Posts: 246

Rep: Reputation: 30
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.
 
Old 02-18-2006, 01:26 AM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
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
 
Old 02-18-2006, 02:27 AM   #4
odevans
Member
 
Registered: Nov 2005
Location: Columbus, OH, USA
Distribution: Slackware
Posts: 246

Rep: Reputation: 30
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).
 
Old 02-18-2006, 05:10 PM   #5
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
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.
 
Old 02-20-2006, 07:10 AM   #6
s4006576
LQ Newbie
 
Registered: Dec 2003
Posts: 10

Original Poster
Rep: Reputation: 0
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.
 
Old 02-20-2006, 07:16 AM   #7
cwwilson721
Senior Member
 
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649
Blog Entries: 1

Rep: Reputation: 67
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 07:17 AM.
 
Old 02-21-2006, 08:57 PM   #8
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
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.
 
Old 02-21-2006, 09:04 PM   #9
odevans
Member
 
Registered: Nov 2005
Location: Columbus, OH, USA
Distribution: Slackware
Posts: 246

Rep: Reputation: 30
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 09:05 PM.
 
Old 02-24-2006, 08:46 PM   #10
s4006576
LQ Newbie
 
Registered: Dec 2003
Posts: 10

Original Poster
Rep: Reputation: 0
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Runlevels nin881 Slackware 8 05-21-2005 02:50 AM
booting/runlevels trey31357 Slackware 2 05-15-2005 07:12 PM
RunLevels bcom Mandriva 3 05-31-2004 07:07 PM
runlevels? Computergirl24 Linux - Software 4 12-26-2003 04:45 PM
runlevels kriver Linux - General 1 03-13-2002 05:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration