Linux

Quick Reference | For Job seekers

Linux Booting Process

Following are the process which is running behind the screen after we press START button on Linux machine

1. BIOS : Which perform some system integrity checks and executes the boot loader program. It looks for boot loader location whether it is in HD, Floppy or CD.

2. MBR : Master Boot Recorder is located at the first sector of bootable disk. It contains the information about GRUB and execute the same.

3. GRUB: Grand Unified Bootloader has the knowledge of the file system.  If there is multiple kernel installed on the system, we can choose which one to be executed.  /boot/grub/grub.conf contains Kernel and inetrd image, so in simple terms GRUB just loads and executes Kernel and initrd images

4. Kernel : Kernel is the back born of Operating system. Which executes the /sbin/init program and It mount the root file system as specified in the “root=” in grub.conf .  initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted.

5. Init: Init  program looks at the /etc/inittab file to decide the Linux run level. Which uses to load all appropriate program.

6. Run Level: Depending on your default init level setting, the system will execute the programs from one of the following directories.

  • Run level 0 – /etc/rc.d/rc0.d/
  • Run level 1 – /etc/rc.d/rc1.d/
  • Run level 2 – /etc/rc.d/rc2.d/
  • Run level 3 – /etc/rc.d/rc3.d/
  • Run level 4 – /etc/rc.d/rc4.d/
  • Run level 5 – /etc/rc.d/rc5.d/
  • Run level 6 – /etc/rc.d/rc6.d/

 

Important Linux Commands

Logical Volume Management (LVM)

Redundant Array of Inexpensive Disks (RAID)

A Redundant Array of Independent Disks (RAID) puts multiple hard drives together to improve on what a single drive can do on its own. Depending on how you configure a RAID, it can increase your computer’s speed while giving you a single “drive” that can hold as much as all of the drives combined.
RAID 0 — Minimum 2 HD, No mirror or parity, Data will be stripped on drives.
RAID 1 – Mirroring, Minimum 2 drives, Good performance and redundancy
RAID 5 – Stripping with parity. Minimum 3 disk, Good performance and redundancy
RAID 10 – Blockss MIrrored and stripped. Minimum 4 disk

Use of /etc/fstab

/etc/fstab contains information of where your partitions and storage devices should be mounted and how.

Device       MountPoint     Filesyatem     MountOpetion                                                  dump,fsck
/dev/sda1   /usr                           ext4                 usrjquota=quota.user,jqfmt=vfsv0             1 2

What is umask ?

To set this value permanently for a user, it has to be put in the appropriate profile file which depends on the default shell of the user.

What is inode?

The inode is a data structure in a Unix-style file system which describes a filesystem object such as a file or a directory. Each inode stores the attributes and disk block location(s) of the object’s data.

Where the kernel modules are located ?

The ‘/lib/modules/kernel-version/’ directory stores all kernel modules or compiled drivers in Linux operating system. Also with ‘lsmod’ command we can see all the installed kernel modules.

Important Services and Ports

SMTP         25
DNS            53
HTTP         80
HTTPS      143
MySQL     3306
MSSQL    1143
POP3        110
IMAP        143
FTP             20 (data transfer) , 21 ( Connection established)
DHCP       67/UDP(dhcp server) , 68/UDP(dhcp client)
SSH            22
Squid        3128

What is Puppet Server ?

Puppet is a automation software used to push configuration to its clients (puppet agents) using code. Puppet code can do a variety of tasks from installing new software, to check file permissions, or updating user accounts & lots of other tasks.

Subnet mask

Subnetmask is a mask used to determine what subnet an IP address belongs to. Subnetting enables the network administrator to further divide the host part of the address into two or more subnets. In this case, a part of the host address is reserved to identify the particular subnet.

Hub,  Switch and Router

Hubs, switches, and routers are all computer networking devices with varying capabilities. let you connect one or more computers to other computers, networked devices, or even other networks.

Hub is typically the least expensive, least intelligent, and least complicated of the three. Its job is very simple – anything that comes in one port is sent out to the others.

switch does essentially what a hub does, but more efficiently. By paying attention to the traffic that comes across it, it can “learn” where particular addresses are. Even accepting that first message, however, the switch has learned something – it knows on which connection the sender of the message is located. Thus, when machine “A” responds to the message, the switches only need to send that message out to the one connection:

router is connected to at least two networks, commonly two LANs or WANs or a LAN and its ISP’s network. Routers are located at gateways, the places where two or more networks connect, and are the critical device that keeps data flowing between networks and keeps the networks connected to the Internet.

Spamming Phishing and Spoofing

Spamming: It is also known as unsolicited bulk e-mail messages or any email messages irrespective of content that is unwanted or unrequested by the recipient

Phishing: Phishing is a special type of spam that is intended to trick you into entering your personal or account information for the purpose of breaching your account and committing identity theft or fraud.

Spoofing : Spoofing is the forgery of an e-mail header so that the message appears to have originated from someone or somewhere other than the actual source. Spoofing is often used by spammers and can be accomplished by changing your “FROM” e-mail address.

What is SSL and How to manage it via SSH

Secure Sockets Layer is the standard security technology for establishing an encrypted link between a web server and a browser. This link ensures that all data passed between the web server and browsers remain private and integral.

Generate CSR request
openssl req -new -newkey rsa:2048 -nodes -keyout domain.com.key -out domain.com.csr
Retrieve the certificate installed for a domain via SSH
openssl s_client -showcerts -connect domain.com:443
Check expiry date of a domains SSL from the Linux command line :
 echo | openssl s_client -connect domain.com:443 2>/dev/null | openssl x509 -noout -dates
Extract all details from SSL certificate
echo | openssl s_client -connect domain.com:443 2>/dev/null | openssl x509 -noout -text
Verify SSL Certificate and Key matching via SSH
openssl x509 -noout -modulus -in certificate.crt | openssl md5
openssl rsa -noout -modulus -in privateKey.key | openssl md5
openssl req -noout -modulus -in CSR.csr | openssl md5