Saturday 15 June 2013

/etc/inittab file Disable ALT+CTRL+DEL key combination, Increse Virtual consoles number

/etc/inittab

The /etc/inittab file holds instructions for your system on how to manage terminal devices. A line in the /etc/inittab file has four basic components: an ID, a runlevel, an action, and a process.

Terminal devices are identified by ID numbers, beginning with 1 for the first device. The runlevel at which the terminal operates is usually 1. The action is usually respawn, which means to run the process continually. The process is a call to the mingetty, mgetty, or agetty with the terminal device name.

Wrong editing in this file could be dangerous even it could crash Linux system. We suggest you to take back up first before editing in this file.

#cp /etc/inittab  /root 
 
With this file you can change default run level, increase virtual terminals and disable ALT+CTRL+DEL key combination to restart the system.

After taking backup open /etc/inittab file

[root@ns1 ~]# vi /etc/inittab

 

Change Default Run Level

 Linux have seven run levels. Functions of all run level are

# Default runlevel. The runlevels used by RHS are:
#   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)
 

During system startup process Linux check this file to determines which runlevel it should be boot by looking at the initdefault directive in /etc/inittab. For example, the entry

 id:5:initdefault: 
 
shows a default starting point in runlevel 5, which is associated with the GUI

To change this default runlevel locate this tag id:5:initdefault: Now replace the value 5 to 3 as show here to boot system in run level 3 Save the file and restart the system it will boot now in run level 3.



#   6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
 


How to disable ALT+CTRL+DEL key combination

 By default ALT+CTRL+DEL key combination is used to restart the system. This default behavior is also controlled by this tag in /etc/inittab file.

 # Trap CTRL-ALT-DELETE
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now

 By some mean if you don't want to use ATL+CTRL+DEL key to restart the system. Put a hash # sign to this tag and save the file and restart the system. Now you cannot restart the by ATL+CTRL+DEL key.

 

How to increase the number of virtual consoles

Virtual consoles are configured in /etc/inittab. By default, RHEL is configured with six virtual consoles. You can configure up to twelve virtual consoles in /etc/inittab.

Here are the default /etc/inittab entries for the first six virtual consoles:



# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
 
 To increase the number of virtual console copy the configuration line of last virtual console and past just below the default line and change the number as shown in image. Save file and restart the system.


# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
7:2345:respawn:/sbin/mingetty tty7
8:2345:respawn:/sbin/mingetty tty8
9:2345:respawn:/sbin/mingetty tty9


After restart you can login in to increased terminals by pressing ALT+Funcation key combinations.



[root@ns1 ~]# tty
/dev/tty7
[root@ns1 ~]#
 

Other use full commands

 #init [run level]

With this command you can switch between run levels. For example to go on run level one type
 
#init 1 
This will take you on run level one.
 
#telinit 1 

Same as init. This will also take you on run level one.
 
#runlevel 

To know on which run level are you working now use runlevel commands.

 


No comments:

Post a Comment