Working with "/etc/inittab" file

Working with /etc/inittab file to manage defualt runlevels.

Here we will learn,

1. How to set defualt Runlevel ?
2. How to disable immidiate shutdown by Pressing "Ctrl + Alt + Delete" ?
3. How to set immidiate shutdown by Pressing "Ctrl + Alt + Delete" for only Particular users.?


1.Types of Runlevels;

0 - Halt Or Shutdown #Dont set it as defualt
1 - Single User Mode # Used for maintainence purpose
2 - Multiuser, without Networking
3 - Full multiuser with Networking #Can be used as defualt runlevel
4 - Not Defined #Can be customize as per user
5 - X11 (GUI) #Always defualt runlevel
6 - Reboot #Dont set it as defualt


To make any runlevel defualt,

Edit /etc/inittab file & search for "id:5:initdefualt:" line, here just replace Runlevel 5 with any other runlevel like "3" and save file. So now when you restart it again it'll boot in Runlevel 3.





2. How to disable immidiate shutdown by Pressing "Ctrl + Alt + Delete",

Edit /etc/inittab file & search for "ca::ctrlaltdel:/sbin/shutdown -t3 -r now" line & comment it with "#", now save & exit.




Make it like,




3. How to set immidiate shutdown by Pressing "Ctrl + Alt + Delete" for only Particular users.?


Make files,

/etc/shutdown.allow
/etc/shutdown.deny

Add all users who can have access for this combination in "/etc/shutdown.allow" else other to "/etc/shutdown.deny" file.

Now edit file "/etc/inittab" file,


add "-a" option in "ca::ctrlaltdel:/sbin/shutdown -t3 -r now" line as below,

ca::ctrlaltdel:/sbin/shutdown -a -t3 -r now

Save & exit.

Comments

Popular posts from this blog

Recover or restore initramfs file in RHEL or CentOS 7

Space reclamation / UNMAP on RHEL or CentOS 7

How to recover /boot partition on RHEL or CentOS 7?