LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Disable GUI (https://www.linuxquestions.org/questions/linux-general-1/disable-gui-572426/)

veeruk101 07-26-2007 09:27 AM

Disable GUI
 
How do you disable the GUI (X server?) in Linux for server machines that don't require anything but a command-line interface? I'm a newbie but I've read about runlevel 3 - is running it in runlevel 3 the standard way of disabling GUI for production servers?

Also, how can you remove the GUI functionality so that you can't do startx or start up the GUI or X server in any way, because I wouldn't want the option to start the X server on a production machine?

Thanks.

XavierP 07-26-2007 09:30 AM

First, edit /etc/inittab and change whatever the current runlevel is and change it to the one you need (I won't give the numbers as I think some distros have different numbers to others). This will stop your OS from booting into GUI by default.

Then uninstall Xorg and KDE or Gnome or whatever your GUI is with your package manager.

farslayer 07-26-2007 09:37 AM

I would simply not install the GUI to begin with. I prefer a slim server containing ONLY the basics necessary for operation and the additional daemons for the servers purpose..

This is simple to achieve with Debian, and Ubuntu Server, just don't select desktop environment during install. I would imagine RHEL / CentOS can't be much different, I would think there would be an option during install to install or not install the GUI.

RedHat if I recall runlevel 3 is without GUI and runlevel 5 is with GUI.

http://www.redhat.com/docs/manuals/e...utdown-rl.html

Linville79 07-26-2007 09:58 AM

All of the default installations of RHEL include GNOME.

You can install without X or GNOME by customizing the package selections and removing those options from the list.

If you've already installed all of it, you can use the Add/Remove Software option in the menu to get rid of GNOME from Desktop Environment set and X Window System from the Base System set.

If disk space isn't an issue, you could also just boot to runlevel 3 and then chmod /usr/bin/startx to 700. That will remove all users' permissions to that command, except root. This would probably be the quickest and least intrusive option.

jiml8 07-26-2007 10:10 AM

Quote:

Originally Posted by XavierP
First, edit /etc/inittab and change whatever the current runlevel is and change it to the one you need (I won't give the numbers as I think some distros have different numbers to others). This will stop your OS from booting into GUI by default.

Then uninstall Xorg and KDE or Gnome or whatever your GUI is with your package manager.

Unfortunately it might not be quite that simple. Ubuntu, for instance, gives you two choices: What we normally expect to be runlevel 5 and what we normally expect to be runlevel 1.

Ubuntu, IIRC (I don't have my laptop in front of me) starts you in what it calls runlevel 2, which is runlevel 5. If you change to runlevel 5, you get the same thing.

Most standard and reliable way (I think) would be for the poster to set runlevel 3 then edit the /etc/rc3.d directory (wherever that actually is on his distr) to make sure the display manager is removed and won't start.

Wim Sturkenboom 07-26-2007 12:42 PM

Quote:

Originally Posted by Linville79
... and then chmod /usr/bin/startx to 700. That will remove all users' permissions to that command, except root. This would probably be the quickest and least intrusive option.

startx is just a script that calls xinit to start X. So chmod on startx will not help that much against knowledgable users.

veeruk101 07-27-2007 12:28 AM

Out of curiosity, is it possible to 'disable' a runlevel - in particular 5, maybe perhaps 2 and 4?

Quote:

# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
If you know that you'll only ever use 0,1,6 for maintenance activities and 3 for actually running it, could you do away with 2, 4, and 5? I ask out of curiosity about Linux rather than practical purposes - though if there is a way, I might consider the option.

Linville79 07-27-2007 12:52 AM

Quote:

Originally Posted by Wim Sturkenboom
startx is just a script that calls xinit to start X. So chmod on startx will not help that much against knowledgable users.

True enough, but "knowledgeable users" would also be able to just boot into single user mode and reset the root password. Then they'd do whatever they want anyway. And if you're worried about that, then removing the GUI isn't going to do you much good.

If this indeed is a security related question, then I think running a GUI interface is very low on the priority list.


All times are GMT -5. The time now is 01:12 AM.