LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 07-26-2009, 11:14 AM   #1
michalng
Member
 
Registered: Dec 2005
Distribution: Debian KDE / Fluxbox
Posts: 222

Rep: Reputation: 46
Fluxbox without GDM ?


Trying to use Fluxbox and is currently using GDM.

Is it possible to start fluxbox without using any GDM/KDM/Slim etc? Googled and found something like this
Quote:
echo "exec startfluxbox" > ~/.xinitrc

How can I shutdown the computer using fluxbox's menu without going to root (or sudo)?
 
Old 07-26-2009, 03:08 PM   #2
mark_alfred
Senior Member
 
Registered: Jul 2003
Location: Toronto, Ontario, Canada
Distribution: Ubuntu Linux 16.04, Debian 9, LineageOS 13
Posts: 1,432

Rep: Reputation: 170Reputation: 170
Quote:
Originally Posted by michalng View Post
Trying to use Fluxbox and is currently using GDM.

Is it possible to start fluxbox without using any GDM/KDM/Slim etc?
The startx command works. I guess if you have other desktop environments, then running "startx startfluxbox" might be a command that would work. I myself only have fluxbox; so, simply typing "startx" works for me.

Quote:
Originally Posted by michalng View Post
How can I shutdown the computer using fluxbox's menu without going to root (or sudo)?
Here's what I have:

In /usr/local/bin, I placed a small script that I named "quit". It is as follows:
Code:
#!/bin/sh
MSG="`which gxmessage`" || MSG=xmessage

$MSG -buttons "Reboot:1,Shutdown:2,Cancel" -center -title "Quit" "Reboot or Shutdown ?"
case $? in
   1) 'reboot' ;;
   2) 'halt' ;;
  *) 'exit' ;;
esac
The package gmessage is required for this to work (it gives you a window with the three options).

Using the command "visudo -f /etc/sudoers", as root, I edited the file /etc/sudoers to include the following:

Code:
%shutdown ALL=(root) NOPASSWD: /sbin/reboot.sh
%shutdown ALL=(root) NOPASSWD: /sbin/halt.sh
This gives regular users the ability to run the commands halt and reboot, as is included in the quit script above.

Last edited by mark_alfred; 07-26-2009 at 03:13 PM.
 
Old 07-27-2009, 10:52 AM   #3
michalng
Member
 
Registered: Dec 2005
Distribution: Debian KDE / Fluxbox
Posts: 222

Original Poster
Rep: Reputation: 46
mark_alfred, thanks for the help.


Quote:
Is it possible to start fluxbox without using any GDM/KDM/Slim etc?
The startx command works. I guess if you have other desktop environments, then running "startx startfluxbox" might be a command that would work. I myself only have fluxbox; so, simply typing "startx" works for me.
A direct startx will not get me to fluxbox. I did the following to get it working :

As a normal user : echo "exec startfluxbox" > ~/.xinitrc
only then the startx will work properly

Quote:
Using the command "visudo -f /etc/sudoers", as root, I edited the file /etc/sudoers to include the following:

Code:

%shutdown ALL=(root) NOPASSWD: /sbin/reboot.sh
%shutdown ALL=(root) NOPASSWD: /sbin/halt.sh
What I did was; as root, run the commnand "visudo" and edited the file presented to me in nano

%shutdown ALL=(root) NOPASSWD: /sbin/reboot
%shutdown ALL=(root) NOPASSWD: /sbin/halt


Again in root, run the command "groupadd shutdown".

Again in root edited the file /etc/group
shutdown:x:1001:myusername


Now in console as a normal user, I can shutdown the computer without entering any password with the command "sudo halt"

Last edited by michalng; 07-27-2009 at 10:54 AM.
 
Old 07-27-2009, 09:55 PM   #4
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Yes, you are correct, starting X only starts fluxbox if you add the 'exec startfluxbox' to .xinitrc

A nicety is to start X automatically; in .bashrc:
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec /usr/bin/xinit -- -nolisten tcp
fi

This will then start X automatically as soon as you login to the first console terminal; other terminals and shells started later from within the desktop are unaffected.

You could even add the shutdown at the end, so that the system shuts down automatically when you exit the desktop.

I use xinit instead of startx because this saves a (small) amount of memory. The '-nolisten tcp' is to turn off remote access to X (which is how startx is typically configured anyway).
 
Old 07-27-2009, 11:05 PM   #5
michalng
Member
 
Registered: Dec 2005
Distribution: Debian KDE / Fluxbox
Posts: 222

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by neonsignal View Post
Yes, you are correct, starting X only starts fluxbox if you add the 'exec startfluxbox' to .xinitrc

A nicety is to start X automatically; in .bashrc:
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec /usr/bin/xinit -- -nolisten tcp
fi

This will then start X automatically as soon as you login to the first console terminal; other terminals and shells started later from within the desktop are unaffected.

You could even add the shutdown at the end, so that the system shuts down automatically when you exit the desktop.

I use xinit instead of startx because this saves a (small) amount of memory. The '-nolisten tcp' is to turn off remote access to X (which is how startx is typically configured anyway).
This looks interesting!

Will be great if you can help to explain a little what each line does
Quote:
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec /usr/bin/xinit -- -nolisten tcp
fi
How does a script that will shuts down the computer automatically when exiting the desktop looks like?
 
Old 07-27-2009, 11:32 PM   #6
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec /usr/bin/xinit -- -nolisten tcp
fi
The '-z "$DISPLAY"' checks that the DISPLAY parameter does not exist (if it does, this implies that X is already started).

The '$(tty)' match checks to make sure that this is being run from console terminal 1 (so that you can still run a normal shell from other terminals, and so remote logins don't start X).

The 'exec' of xinit replaces the bash shell with xinit, and the '-nolisten tcp' parameter turns off X access over TCP/IP (it is more secure to run remote X sessions using 'ssh -X', so that the X ports are not exposed).

Quote:
How does a script that will shuts down the computer automatically when exiting the desktop looks like?
Sorry, I realize that you can't just add the shutdown into the .bashrc script, because the exec means that the shell is gone, and the script will not return here. On the other hand, keeping the shell would defeat the purpose of reducing memory use.

Perhaps instead you could call your halt script from the fluxbox menu exit; in /etc/X11/fluxbox/fluxbox-menu, change the Exit line to:
[exec] (exit) {ExecCommand halt.sh}

You still have to set up the sudo for halt script as you already did.
 
Old 07-28-2009, 12:05 AM   #7
michalng
Member
 
Registered: Dec 2005
Distribution: Debian KDE / Fluxbox
Posts: 222

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by neonsignal View Post
Perhaps instead you could call your halt script from the fluxbox menu exit; in /etc/X11/fluxbox/fluxbox-menu, change the Exit line to:
[exec] (exit) {ExecCommand halt.sh}

You still have to set up the sudo for halt script as you already did.
Thanks for the explanation, it helps my understanding base on the limited knowledge I have with computers.

Base on my earlier post, I had earlier setup the menu with (and it works)
[exec] (Shutdown) {sudo halt}


 
Old 07-28-2009, 12:34 AM   #8
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 57
Quote:
Originally Posted by michalng View Post
Trying to use Fluxbox and is currently using GDM.

Is it possible to start fluxbox without using any GDM/KDM/Slim etc? Googled and found something like this


How can I shutdown the computer using fluxbox's menu without going to root (or sudo)?
the best way, fast is this one:
Code:
Automated Logins Revisited LG #72
Alternatively one can install the autologin package ...  fred on startup, initiating fred's chosen graphical ...
linuxgazette.net/issue72/chung.html - Cached - Similar
or u can specify that autologin directlzy into gdm
Code:
sudo gdmsetup
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
gdm and fluxbox lord-fu Slackware 2 11-12-2006 06:42 PM
Fluxbox from gdm bratch Linux - Software 2 04-07-2005 09:24 AM
Fluxbox vs GDM/xfs wampfler Fedora 3 08-20-2004 12:59 AM
gdm overwrites /etc/gdm/Session/fluxbox _flaab_ Mandriva 0 12-21-2003 11:58 AM
fluxbox / gdm ilhbutshm Linux - Newbie 1 11-27-2003 09:52 AM

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

All times are GMT -5. The time now is 08:51 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration