In: Computer Science
In Linux
Your response to each should meet the following criteria:
please type your answer, I will rate you well.
sudo halt
sudo reboot
sudo poweroff
Modify the /etc/sudoers by adding following lines:
%admin ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff
The above line represents that all users in admin group is allowed to execute halt and reboot the system
and add yourself to the admin group.
The defualt runlevel starts from 0 and end with 6.This means there are 7 runlevels in any Linux system.
0 System halt (the default level)
1 Single user mode(runlevel 1)
2 Multi user mode without networking
3 Multi user mode with networking
4 Not used/special purpose
5 Multi user mode with GUI
6 System reboot
As you ask in the question how can i change the system runlevel.For that my answer is ,all runlevels are defined in a directory "/etc/rcX.d",where X corresponds to the runlevel.
Changing the Viewing the run level:
You can view the default runlevel of the system which is defined in the file /etc/inittab.
#grep ^id/etc/inittab
id:3:initdefault:
As you can see from the above output,the default runlevel is 3.If you want to change this to runlevel 1,edit the /etc/inittab file with the following line:
id:1:initdefault:
You can change the runlevel in otherway,by using the command telinit(stands for telling init 0 change runlevel).This actually signals "init" process to change the runlevel.
#telinit 1