26 Basic system administration

Mr. Hardik Joshi

epgp books

 

Linux Daemons

 

We have already seen in module #12 that daemons are processes that run in background indefinitely. Daemons are generally server processes that are used to provide services to the clients. In most of the cases, the daemon process starts with the booting of Linux system and terminates when the system shuts down. Some examples of daemons are httpd (web server), vsftpd (file server), crond (job scheduler), etc. Few other processes like firewall keep on running from the booting of the system to its shutdown phase. An efficient administrator must know how to start and stop daemons, how to enable and disable daemons and so on.

 

Service Command

 

The service command is used to start, stop or restart a daemon. Since the daemons are server processes, the user with root privileges can modify the status of daemons. Hence, the service command can be executed only by the root user or user with root level privileges. Let us see the syntax of service command with few examples:

 

Syntax:

$service SCRIPT COMMAND [OPTIONS]

Example:

The service command can be either executed with the ‘#’ prompt or using the sudo command. In the above example, we are modifying the status of httpd. The daemon httpd is a web server, so the command starts, stops and restarts the web server. The service command is also used to query the status.

Note: Recently, the linux distributions have switched from using service command to systemctl command. In future, most of the distributions will support systemctl command.

 

Systemctl is a systemd utility and is responsible for Controlling the system and service manager. The system V init daemon is being replace by Systemd, it is a collection of system management daemons, utilities and libraries.

Example:

 

Starting / Stopping Firewalls

 

In linux, firewall executes as a service. The firewall can be enabled/disabled or started and stopped as and when required. The ‘iptables’ is the firewall in Linux. Some times it is required to troubleshoot networking by modifying the status of iptables.

 

Example:

In Ubuntu, there is another command that deals with the firewall, “ufw” is the command which means ‘uncomplicated firewall’.

Example:

 

Overview of Runlevels

 

Linux operating system boots with a specific runlevel. Each runlevel has its significance, for instance the system booted with runlevel 1 will be in a single user mode, hence no one will be able to logon to that system until it is in runlevel 1.However, when the system is booted in runlevel 2, it supports multiple users. Each runlevel has a certain number of services stopped or started, giving the user control over the behavior of the machine. Conventionally, seven runlevels exist, numbered from zero to six. The list of runlevels and its description is mentioned in the following table:

Daemons execute with some runlevel. For example, suppose if we want to modify the services of httpd, we may execute the httpd process with run level 0 (single user mode) so that no other client can access the webserver. So, we can troubleshoot the webserver while it is running though it won’t be accessible to others. If we wish to run webserver in such a way that others can access it, we can start the httpd service in runlevel 3.

The chkconfig command is used to check the status of runlevels, modify runlevels and enable/disable the runlevels. Chkconfig command is used to setup, view, or change services that are configured to start automatically during the system startup

 

Figure 1: Output of chkcofig command

 

We can scan the runlevel of selected services using the following technique:

 

The chkconfig command can also be used to enable a particular runlevel for the daemons. By specifying the option on/off, we can either enable or disable services for particular runlevels.

Network Configuration

Now let us see how to display the IP address of any system, later we will see how we can modify the IP addresses. The following command can be used to retrieve network related information:

The ifconfig command displays network configurations of all interfaces. In the figure 2, we can see that IP address is assigned to wlan0 (wirelesss card) but it is not assigned to eth0 (Ethernet card). The name of adapter like eth0 or wlan0 may vary depending on the linux distribution. The configurations listed in figure 2 are stored in a file /etc/network-scripts/ifcfg-eth0.

Few other Network related Commands

Let us summarize the key concepts covered in this module

  • What is a runlevel and how to modify it
  • How to start/stop services.
  • How to enable/disable services.
  • How to configure networking in Linux.
  • Few network related commands
you can view video on Basic system administration

References

  1. Tom. Adelstein and Bill. Lubanovic. 2007. Linux system administration, O’Reilly.
  2. Sam R. Alapati. 2016. Modern Linux Administration How to Become a Cutting-edge Linux Administrator., Oreilly & Associates Inc.
  3. Kirk. Bauer. 2003. Automating UNIX and Linux administration, Apress.
  4. Richard Blum. 2008. Linux command line and shell scripting bible, Wiley Pub.
  5. M. Carling, Stephen. Degler, and James. Dennis. 2000. Linux system administration, New Riders.
  6. Chuck. Easttom and Serge N. Palladino. 2012. Essential Linux administration : a comprehensive guide for beginners, Course Technology/Cengage Learning.
  7. Richard Fox. Linux with operating system concepts,
  8. Aeleen. Frisch. 2002. Essential system administration, O’Reilly.
  9. el. .            . Linux system administration : a user’s guide, Addison-Wesley.
  10. Juliet. Kemp. 2009. Linux system administration recipes : a problem-solution approach, Apress.
  11. Olaf. Kirch and Terry. Dawson. 2000. Linux network administrator’s guide, O’Reilly.
  12. Olaf. Kirch and Terry. Dawson. 2000. Linux network administrator’s guide, O’Reilly.
  13. Mark (Mark F… Komarinski, Cary. Collett, and Inc. Red Hat. 2000. Red Hat Linux administration handbook, Prentice Hall PTR.
  14. Chris Negus. Linux bible,
  15. Roderick W. Smith. 2007. Linux administrator street smarts : a real world guide to Linux certification skills, John Wiley.
  16. Wale Soyinka. Linux administration : a beginner’s guide,
  17. Vicki. Stanfield and Roderick W. Smith. 2002. Linux system administration, Sybex.
  18. Nicholas. Wells. 2000. Guide to Linux installation and administration, Course Technology, Thomson Learning.
  19. Matt. Welsh, Matthias Kalle. Dalheimer, Terry. Dawson, and Lar. Kaufman. 2003. Running Linux, O’Reilly.