LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-26-2007, 10:27 AM   #1
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
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.
 
Old 07-26-2007, 10:30 AM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,176
Blog Entries: 4

Rep: Reputation: 430Reputation: 430Reputation: 430Reputation: 430Reputation: 430
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.
 
Old 07-26-2007, 10:37 AM   #3
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
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
 
Old 07-26-2007, 10:58 AM   #4
Linville79
Member
 
Registered: Nov 2006
Location: Indiana, U.S.A.
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134

Rep: Reputation: 16
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.

Last edited by Linville79; 07-26-2007 at 11:00 AM.
 
Old 07-26-2007, 11:10 AM   #5
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
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.
 
Old 07-26-2007, 01:42 PM   #6
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
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.
 
Old 07-27-2007, 01:28 AM   #7
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Original Poster
Rep: Reputation: 16
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.
 
Old 07-27-2007, 01:52 AM   #8
Linville79
Member
 
Registered: Nov 2006
Location: Indiana, U.S.A.
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134

Rep: Reputation: 16
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.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to disable GUI effects in KDE 3.5 (Fedora Core 5) virstulte Linux - Desktop 4 08-26-2006 12:28 AM
Disable GUI boot on Init 5 rickylim Linux - Enterprise 4 05-30-2006 03:01 PM
Disable GUI Desktop on Solaris 10. Zepiroth Solaris / OpenSolaris 2 11-04-2005 09:31 AM
Disable GUI Login and Config StartX firefly2442 Linux - Newbie 6 07-22-2003 12:02 AM
Disable GUI in Redhat 8.0 TexasDex Linux - General 3 03-24-2003 01:12 PM


All times are GMT -5. The time now is 09:33 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration