Results 1 to 4 of 4
How to remove X completly from the system?
As a Security practice I wanted to disable X from loading.
So i modified following line from /etc/inittab.
id:3:initdefault:
I was then ...
- 06-08-2011 #1Just Joined!
- Join Date
- Mar 2011
- Posts
- 17
How to remove X from linux distribution?
How to remove X completly from the system?
As a Security practice I wanted to disable X from loading.
So i modified following line from /etc/inittab.
id:3:initdefault:
I was then able to start my machine in terminal mode(runlevel 3).
I wasn't satisfied at this stage as i was able to get the graphical console by merely typing
Code:
So i search and find out that the reason for loading the graphical user interface was a script resided inCode:#init 5
Code:
i renamed it thinking OS will fail in finding it when invoked by inittab file .Code:/etc/X11/prefdm
To my surprise i was able to get the terminal back even if i hit
#init 5
but then i realize i keep on getting following error lines.
I found out the reason behind this was a line in /etc/inittabCode:INIT: cannot execute "/etc/X11/prefdm" INIT: cannot execute "/etc/X11/prefdm" INIT: Id "x" respawning too fast: disabled for 5 minutes respawn
Code:
(respawn The process will be restarted whenever it terminates)Code:x:5:respawn:/etc/X11/prefdm -nodaemon
Since the file prefdm was renamed and respawned the OS was keep on trying to execute it considering it is terminated.
Now i have made the above line commented and removed execute bit of the file .
System is now behaving as i wish it would.
I have 2 questions here.
1)Is this Method considered to be stardard while removing X in linux distro.
Will it make any difference?
I m not using any application that explicitly use graphical user interface and i can work in runlevel 3.
2)Is any package responsible for loading X .If yes then removing shall remove X from the system,correct me if i m wrong.
My distribution Details.
Code:# uname -r 2.6.18-92.el5
Code:# lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: EnterpriseEnterpriseServer Description: Enterprise Linux Enterprise Linux Server release 5.2 (Carthage) Release: 5.2 Codename: Carthage
- 06-08-2011 #2
if you want to remove X, its pretty simple to just use yum and remove x11 packages
you need root access to change init to runlevel 5 from 3, though i will say that users can still run "startx" command and bring up x-windows (at least locally) so if you don't want it, just remove packages, it shouldn't be an issue if you aren't using any X applications
- 06-08-2011 #3Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
or they could reboot and add " 5" to the kernel args, over-ruling /etc/inittab, to take them to runlevel 5 (if you don't have grub password-protected).
like coopstah13 said, best bet is to remove the X packages. but of course, if they can get root (which by default is easy, if they are local to the machine) your efforts are in vain (assuming they can get networking up or mount media).
- 06-08-2011 #4Just Joined!
- Join Date
- May 2011
- Location
- Southern California, US
- Posts
- 24
If you *know* that none of your programs ever use init 5, you *could* delete the X11 server via YUM or RPM.
If you want to keep it around, just in case, but still want to keep init 5 away from most prying eyes, then:
1. Edit the /etc/inittab file and change the id:5:initdefault: to id:3:initdefault:
2. Move the /etc/X11/prefdm file to /etc/X11/prefdm.orig
3. Create a new /etc/X11/prefdm with two lines in it:
#!/bin/sh
init 3
This will cause a loop. Whenever someone tries to init 5, it will automatically switch to init 3 instead. If you ever really need to get init 5, you will have to copy /etc/X11/prefdm.orig back into /etc/X11/prefdm.
Tom


Reply With Quote