Introduction to Linux Distributions
Today, there are several Linux distributions in the market. These distributions include Kali Linux, Fedora, Manjaro, Gentoo, Linux Mint, Debian, CentOS, RedHat, Ubuntu, OpenSUSE just to mention a few. A distribution or distro is a suite i.e. a collection of application software and programs that work together to enable carrying out of computing tasks. A software suite consists of networking tools, a graphical user interface, applications programs and drivers that provides an abstraction layer between software and the hardware resources of the computer (Soyinka, 2016.
The end users have a wide range of options when it comes to Linux to choose from depending on their preferences and/or what they intend to accomplish. An operating system kernel is the core of that operating system and is responsible for managing software operations and hardware resources i.e. the kernel is the abstraction layer that connects the system hardware and application software. The Linux Operating System (OS) is based on Unix and is packaged for both server and desktop use depending on the user needs and preferences.
In the spirit of user needs and preferences, one may need a Linux distribution for working in a home office. To achieve this fete, it I would advise someone to go for Ubuntu. Ubuntu is built with the end user in mind i.e. the distribution is free, comes with several applications that the user can download by a click of the button from the Ubuntu Software Centre and a built-in firewall and anti-virus protection software for security. Ubuntu comes with a complete set of the essential applications like email, browsers, office suite, media applications, games that a user may need for a home office environment. Ubuntu is also fast with an interactive and easy to use interface where the user can choose between GNOME or Ubuntu Unity. A single user working at home may have needs geared towards user-friendliness and reliability which Ubuntu definitely provide.
In addition to a distribution that supports a single user, there may be a need for a one that can support several users and/or run programs that may need intensive hardware and/or software resources, for example, a university computer science lab. The Linux distribution that may be recommended for this purpose would be
The beauty of Linux distributions is their reputation for stability and reliability when properly configured to run on quality hardware. It is for this reason that CentOS is the best option when it comes to choosing a web server distribution to run a corporate web server. CentOS has a reputation for stability and functionality offering load-balancing and high-availability.
Being built on the Red Hat Enterprise Linux (RHEL) platform, CentOS provides a free version with extensive enterprise support with security updates and training material. CentOS is also hardened by providing the security that may be needed to run mission-critical servers. As an added advantage, the CentOS distribution offers open source server software like Apache Web Server, Sendmail, Samba, BIND, vsFTPD, and CUPS which are critical for any corporate server environment.
Choosing a Linux Distribution for Home Office Use
The Linux Kernel, which shapes the center of the Linux framework, is the outcome of one of the biggest agreeable programming ventures at any point endeavored (Novikov, 2017). Standard releases each nine to ten weeks convey stable updates to Linux clients, each with critical new highlights, included gadget bolster, and enhanced execution. The rate of progress in the piece is high and expanding, with more than 12,000 patches going into every ongoing portion discharge. Every one of these discharges contains crafted by more than 1,600 engineers speaking to more than 200 enterprises. Since 2005, somewhere in the range of 15,600 individual engineers from more than 1,400 distinctive organizations have added to the bit. The Linux Kernel has turned into a typical asset created on a gigantic scale by organizations which are furious competitors in different regions.
“Hot issues” surrounding Linux Kernel development include new drivers, hardening, record numbers, testing. New drivers continue to be released with new releases. The kernel is also being hardened to withstand attacks. Hardening is done by including mapped kernel stacks, new technologies and the use count mechanisms that detects and prevent overflows and also structure randomization techniques found in the GCC plugin. Kernel testing is also conducted to identify zero-day exploits and come up with patches where necessary to counter the vulnerabilities identified.
APT is a huge venture and instrument set, whose unique designs incorporate a graphical user interface. From an end-user point of view, it is revolved around the order line apparatus apt-get and also apt, which was later created to defeat configuration defects of apt-get. There are graphical choices created by outsiders, including synaptic and aptitude. When working with APT, you should first download the rundown of as of now accessible bundles with an apt update. Contingent upon the speed of your association, this can take some time in light of the fact that different packages’ list, sources’ list, and interpretation records have developed in size alongside Debian improvement. Obviously, CD/DVD installations are quicker because they are local to your machine.
Lab 2
Linux installation on my system
This report is about the installation of Kali Linux on my system. The matters of interest include pre-installarion, the process of installation and post installation ( Hertzog, O’Gorman and Aharoni, 2017). Any Linux distribution can be installed on a stand-alone system or in a virtual environment. For the purposes of demonstration, the Linux installation in this scenario (Kali Linux) is installed in a virtual environment indicating the step by step process of installation.
Pre-installation
The prerequisites for this installation include; a 15 GB disk space for the Kali Linux install, RAM (512 MB) for amd64 architecture and an ISO file for Kali Linux 2018 downloaded from the Kali Linux website www.kali.org .
The process of installation
- To start installation, we are going to launch the virtual environment (VMWare Workstation 12 Pro) and choose the necessary requirements for the installation (ISO file, installation configuration, the operating system type in this case Kali Linux, architecture, disk space and RAM).
We begin the installation. One can choose between graphical or text mode installation. In this scenario, we use text-mode installation.
The Kali Linux system represents the BSD startup. Kali Linux uses FreeBSD, a descendant from the family of Unix-like operating systems that provides open source software available in the market today. The BSD system startup are controlled by rc scripts. The rc script found in the directory /etc/rc reads files in the directory /etc/rc.conf and /etc/defaults/rc.conf to determine which service that may be started. The specific service identified is then started by the rc script located in /etc/rc.d , /usr/local/etc/rc.d and /etc/init.d/. Those services that are part of the kernel like syslog and sshd have their scripts located in /etc/re.d/. User applications such as Apache have their scripts located in /usr/local/etc/rc.d/.
Choosing a Linux Distribution for Web Server Use
The kernel is responsible for mounting the root file system and starting of the program, init. The init process is a non-kernel that is the first to be started and is usually assigned a process identification number 1. The init program reads its configuration file /etc/inittab to determine the runlevel it should start from (Soyinka, 2016, p. 181). The systems’ behaviour is dictated by the runlevel usually assigned an integer between zero and six, each performing a designated task. For example, 0 represents the runlevel value stop the system, 1 enter single-user, 2 multiuser mode, 3 full multiuser mode, 4 is unsused, 5 full multiuser mode using an X window system and 6 reboot the system (Jangir, 2015).
The directory /etc/inittab has scripts which are responsible for starting or stopping a service that is unique to a given runlevel. For example, the rc script found in the directory /etc/rc.d/rc is used to call scripts in their correct order for each runlevel. To keep the rc script in the /etc/rc.d/rc directory for being “unruly” due to the fact that it is the one that calls appropriate scripts in their order for each runlevel.
There are subdirectories in the /etc/rc.d directory following a identification scheme rc Y.d. Y identifies the runlevel. The scripts found in the /etc/rc.d/init.d directory are major pillars performing the actual process of starting and stopping services. The rc script found in /etc/rc.d/rc runs through a specific runlevel’s directory to invoke each scripts’ numerical order. Priority is given to the parameter stop over the service start i.e the rc script first runs the scripts that begin with a K (parameter to mean stop) and then the scripts that begin with an S (parameter to indicate start).
It may be necessary to boot your Linux system into single-user mode. Single-user mode is a “safe” way to startup your Linux system i.e. if there is a problem with the booting process as a result of something broken in the startup scripts, then one can boot into the single-user mode. This enables you to make the necessary “fix” and allow the system to boot into complete multiuser mode ((Matotek, Turnbull and Lieverdink, 2017). The steps to boot into single-user mode are demonstrated below:
- To begin, you choose the GRUB section needed for the boot process and press the e key to display the different commands in the /boot/grub/menu file.
- Select the record named kernel, and press e once more. Presently you can include the catchphrase single (or the letter s) to the finish of the line. Press enter to return to the GRUB boot menu, and after that press b to boot the piece into single-client mode.
- When you boot into single-client mode, the Linux bit will boot as ordinary, but when it comes to the heart of the matter where it begins the init program, it will as it experienced runlevel 1 and after that stop. Depending on the framework set up, you will either be prompted for the root password or just given a shell prompt. In the event that prompted for a watchword, type the root secret key and press enter, and you will get the shell prompt.
- In this mode, you’ll see that every one of the administrations that are regularly begun is not running. This incorporates arrange design. So in the event that you have to change the Internet Protocol (IP) address, gateway, netmask, or any system related design record, you can. This is additionally a decent time to run fsck physically on any segments that could not be naturally checked and recuperated to disclose which segments are getting out of hand if there are any.
- When you have rolled out any improvements you have to make, basically press ctrl-d. This will leave single-client mode and proceed with the booting procedure, or you can just issue the reboot command to reboot the system. The dmesg command is used to print or control the Kernel ring buffer. There are various options associated with the dmesg command used to perform various functions in the Linux distro for example dmesg –E is used to enable printing messages to the console, dmesh –e to display the local time and the delta in human-readable format, dmesg –D to disable the printing of messages to the console, dmesg –d to display the timestamp and the time delta spent between messages dmesg –F to read the message from the given file, dmesg –f to restrict output to the given (comma-separated) list of facilities, dmesg –n is used when you want to set the level at which printing of messages is done to the console etc.
Hitting CTRL-ALT-DELETE on most Linux appropriations will begin the reboot process. To disable CTRL-ALT-DELETE, we need to make changes to the inittab file by deleting it, commenting it or even replacing the file. To do this, you need to open /etc/inittab file
#vim /etc/inittab
Search for the file that reads
Ca:12345:ctrlaltdel: /sbin/shutdown –t1 –a –r now
To stop the system from executing the line,add a hash (#) in front of it:
# Ca:12345:ctrlaltdel: /sbin/shutdown –t1 –a –r now
Save the file and exit to shell prompt. Reboot the system to take effect or type the command:
#init q
Lab 4
Users are the people interacting with the system. Therefore, it is important to manage the users effectively. Each user should be given the right level of permission to access resources which include files, processes and user applications (Kerrisk, 2010). Linux has a system that assigns the users a unique user ID. The user(s) may be a single user or belong to multiple groups. Those users that belong to a group have their group assigned a unique identifier called a group ID.
The Linux Kernel: The Heart of Linux
Typically, when a program is controlled by a client, it acquires the majority of the rights (or need thereof) that the client has. On the off chance that the client cannot read the /var/log/ messages document, neither can the program. Note that this authorization cannot be the same as the consents of the client who claims the program file (binary). For instance, the ls program (which is utilized to produce registry postings) is possessed by the root user. The permissions set by ls are set so that all clients of the framework can run the program. In this manner, if the client X runs ls, that example of ls is bound by the consents allowed to the client X, not root.
Nonetheless, there is a special case. Projects can be labeled with what is known as a SetUID bit, which enables a program to be kept running with authorizations from the program’s proprietor, not the client who is running it. Utilizing ls for instance once more, setting the SetUID bit on it and having the document possessed by root implies that if the client X runs ls, that occasion of ls will keep running with root consents, not with X’s authorizations. The SetGID bit works the same path, with the exception of as opposed to applying the record’s proprietor, it is connected to the document’s group setting.
To qualify the SetUID bit or the SetGID bit, you have to utilize the chmod command. To make a program SetUID, prefix whatever authorization esteem you are going to appoint it with a 4. To make a program SetGID, prefix whatever consent you are going to relegate it with a 2. For example, to make /bin/ls a SetUID program, you would use the command: [email protected] ~] chmod PID /bin/ls.
Lab 5
Shell script to monitor the health of /etc/passwd file. Find entries that have UID 0, entries that have no password, entries with duplicate UIDs, entries with duplicate login names and those that have no expiration date.
# This line checks for the root ID. It notifies the user if the root ID exists or not.
echo “Check for root uid…”
awk -F: ‘$1 = ~/root/ {print “Found Root ID”} ‘ /etc/passwd
# Check for duplicate UID by reading the records into an awk array and compare the predecessor with the successor. If the comparison
# result is greater as 1 print the duplicate value.
echo “Check for duplicate UID’s…”
awk -F: ‘uname[$3]++ && uname[$3]>1 {print “duplicate user:”, $1} ‘ /etc/passwd
echo “Duplicate UID check done”
# Check for duplicate UID by reading the records into an awk array and compare the predecessor with the successor. If the comparison result is greater as 1 print the duplicate value.
echo “Check for duplicate user names…”
awk -F: ‘uid[$3]++ && uid[$3]>1 {print “duplicate uid:”, $3}’ /etc/passwd
echo “Duplicate user name check done.”
echo “Check for passwords…”
#`exec su | sh | awk -F: ‘$2 ~/$d$/ {print “User $1 has password}’ /etc/shadow | exit`
exit 0
# End of Script
References
Hertzog, R., O’Gorman, J. and Aharoni, M. (2017). Kali Linux revealed. 1st ed. Offsec Press.
Jangir, M. (2015). Linux Kernel and device driver programming. New Delhi: University Science Press.
Kerrisk, M. (2010). The Linux programming interface. San Francisco: No Starch Press.
Matotek, D., Turnbull, J. and Lieverdink, P. (2017). Pro Linux system administration. 2nd ed.Apress.
Novikov, E. (2017). Evolution of the Linux kernel. Proceedings of the Institute for System Programming of the RAS, [online] 29(2), pp.77-96.
Soyinka, W. (2016). Linux administration. New York: McGraw-Hill Education, p.4.