You are on page 1of 27

INDEX

01. PREFACE

02. ACKNOWLEDGMENT

03. INTRODUCTION TO LINUX

04. SALIENT FEATURES OF LINUX

05. LINUX INSTALLATION (DUAL BOOT INSTALLATION WITH WINDOWS)

06. BASIC ARCHITECTURE OF LINUX FILE SYSTEM

07. MANAGING FILES & DIRECTORIES

08. SHELLS AND KERNEL

08. MANAGING A USER ACCOUNT

09. LINUX NETWORKING

10. NETWORK DESIGNING & IMPLEMENTATION (LOCAL AREA NETWORK)

11. NETWORK SETUP FOR ISP USING LINUX AS OS

12. FTP, TELNET, NFS SERVERS

13. SERVER CONFIGURATION

14. NETWORK SECURITY

15. BIBLIOGRAPHY
INTRODUCTION TO LINUX

Linux is a version of UNIX operating system, the original ancestor of Linux. UNIX is a command-driven
operating system in which the user has to type in commands at the computer console in order to
operate the computer (Introduction to Linux, 2001). UNIX is one of the most popular operating
systems worldwide because of its large support base and distribution (Grove, 1998, section 1.2). It was
originally developed in the 1970s at AT&T as a multitasking system for minicomputers and mainframes.
Since then, it has grown to become one of the most widely-used operating systems.

In 1991, Linus Torvalds, a student at the University of Helsinki, sought to create a new version of UNIX;
therefore, he joined forces with a group of programmers to create a new operating systemLinux.
Linux is a free version of UNIX that continues to be developed by the cooperative efforts of volunteer
groups of programmers, primarily on the Internet, who exchange code, report bug, and fix problems in
an open-ended environment (Grove, 1998, section 1.2). As a result, the world now has a powerful,
robust, and full-featured operating system that continues to change and grow.

Linux is known as an open source operating system and also called free software because everything
about Linux is accessible to the public and is freely available to anyone. Since the Linux source code is
available, anyone can copy, modify, and distribute this software. This allows for various companies such
as SuSE, Red Hat, Caldera and others to sell and distribute Linux; however, at the same time, these
companies must keep their Linux distribution code open for public inspection, comment, and changes
(LeBlanc, Hoag & Blomquist, 2001, p. 298). Despite of the command-line origins of Linux, these
distributing companies are working to make the Graphical User Interface (GUI), the primary means of
user interface; thus more user friendly.

Over the last year, weve seen Linux go from being focused on small and medium business to being
used very deep in the enterprise, says Paul Cormier, executive vice president of engineering at Red Hat,
a leading Linux platform provider.

Basic Features of LINUX OS


There are lots of clones of Linux, no matter what version of Linux you use; the piece of code common to
all is the Linux Kernel. Although the kernel can be modified to include support for the features you want,
every Linux kernel can offer the following features: -

Multi-user

Multitasking & enhanced Symmetric Multiprocessing

Graphical User Interface (KDE, GNOME)


Hardware support (RAM up to 4GB, 10 IDE controllers, 16 NICs, USB)

Networking connectivity (IPX/SPX, TCP/IP, X.25, )

Security (Local & Remote)

Network servers (F/P, HTTP, SMTP, IMAP, POP3, DHCP, DNS, FTP, )

Applications support

Software packaging (RPM)

Easy Installation & Administration

Reliable & Robust (Stable and fault tolerance)

Salient Features of LINUX


-> Linux is the fastest operating system in the world. It runs much faster than Windows. It is about 1.2 to
3 times faster than Windows 9X/NT. In command-line console mode without X-window it runs even
faster (console mode is ideal for Database servers, Apache Web servers, Email servers, News servers,
File servers, DNS servers, Print servers, Network Computer servers, etc..). Linux is also the most
powerful yet simplest and easy to use operating system in the world.

->Linux is the most reliable OS. Windows 9X/NT fails the CRASH_OS_TEST programs and
only Linux passes. Also commercial Unix's like IRIX, Solaris, HPUX, AIX, SCO all fail the crash test
and Linux is the only OS which passes the crash me test. Very often Windows 95 users will get GPF
errors and the system freezes. Linux is very robust because it is built by millions of people on internet
and there are no errors in the kernel. It runs for one full year without any re-boots or any problems
non-stop, guaranteed. It is the best designed OS.

->Linux has an excellent scalability - it runs on Uni-processor, Multi-processors, Parallel


Processors and even Super-computers. It fully supports SMP (Symmetric Multi-Processing) boxes
with more than one CPU. Windows 95 supports only one CPU box. Linux scales much better than NT on
SMP.

->Linux is fully 32-bit & 64-bit operating system. And it is very modular and is already ported
to 64-bit chips like DEC alpha, Sun Micro system UltraSparc, Intel IA64, Motorola Power PC,
Transmeta Corp Crusoe chip and GNU/GPL Freedom 64-bit CPU. Whereas Windows95 has a major
chunk of 16-bit code in its kernel and MS Windows runs only on one type of chip - "Intel chip".
->Linux is a very secure OS. Windows is not a secure OS, break-ins are easy. Windows 95/2000, NT,
MSDOS have computer viruses. But Linux does not have any viruses. Computer viruses causes lot of
damages to Windows 95/2000/NT/8/10 but not to Linux.

->Linux is very mature and is one of the oldest operating system in the world. UNIX (which is another
name for Linux) was born in AT&T Bell Labs 27 years ago for Telecom research. Linux(Unix) is the end-
result of 27 years of research and development effort by U.S/European Universities and mega-
corporations of Europe / America. It took 27 years to create vast amount of Unix information, and all
that info is now just sitting inside this Linux cdrom on our hand. For example, programs like 'grep had
not changed for the past 27 years and they are still used in Linux. Functionality and command line
options of grep had not changed for the past 27 years. Linus started the Linux during 1991, but he
borrowed lot of concepts, code from Unix and this means Linux is 27 years old. Today Linux is the
OCEAN wherein all other UNIX(s) like Solaris, HPUX, AIX merge into. And in near future all other UNIX(s)
will be replaced by Linux.

->Linux uses X-window which is an advanced network-windowing system, whereas Windows 95/NT is a
standalone single-workstation windowing system. For example, using X-window, users can display
output on any workstation-monitor attached anywhere in the network. There is a command called
"xhost" in Linux and display environment variable, export display=`hostname`:0.0. Like this there are lot
of functionalities in X-window which are missing in Windows NT/95. X-Window is an industry standard
which was developed in MIT and is a very powerful network windowing system. With X-window you can
run programs on super-computers and display on your Linux desktop locally. Even though X-window is
network-resource intensive, it is becoming increasingly popular because of the availability of very low
cost, high speed networking like 1 Gig bit Ethernet cards, 100 Megabit Ethernet cards, DSL lines, Cable-
Modems, Frame-relay and ATM networks.

->Linux has very low total_cost_of_ownership since Linux supports diskless nodes. Cost of maintaining
Linux is five times lower than MS Windows.

->Linux supports remote system administration whereas Windows NT/95 does not. We can remote
login and do many system administration tasks, for example like adding users, reboot a Linux server
from remote terminal hundreds of miles.

->Linux runs most windows applications (16bit) like MSOffice, MSWord using WABI ($40), WINE(free)
and MSDOS applications using DOSemu, FreeDOS, Dr.DOS. But Windows95/NT will run only few of
Unix and Linux applications.

->Linux supports su (super user) command. Using su command it is possible to switch user without
logging off. For example, 'su - root' will login as user 'root'. In Windows NT/95 you must log off
completely to switch user. Linux has remote commands like 'rlogin', telnet, etc. while Windows NT/95
does

not have.

->Linux kernel is very small and it can fit on a single floppy. It is less complex but very
sophisticated and powerful. Small kernel means it is very reliable. Linux applications are
much bigger running on top of the Linux Kernel.

->Linux has many powerful desktops like KDE desktop, GNOME, Triteal CDE, Motif mwm,
Openlook olwm, twm, fvwm 95, xdm, xsm, Windows Afterstep, Windowmaker (NeXTstep-
lookalike), Qvwm, amiwm (amiga), mlvwm (mac) etc. KDE desktop is much more user friendly
than Windows95 ! You have more freedom and choice in Linux desktops as compared to
Windows 9X/NT.

->Linux OS needs only 50 MB of disk space for installation. Linux supports dual boot on
the PCs that is, you can have Windows95/NT on one partition and Linux on other. During system
startup user can select to load Linux or Windows 95 and vice versa. Nowadays PCs are shipped with 6
Gigs of disk space.

->Linux runs on many hardware platforms - Intel, Motorola, PowerPC, RISC, DEC Alpha, MIPS, ARM,
Transmeta Crusoe, Sparc architectures and GNU Freedom-64-bit CPU. Linux is already ported to 1024
CPUs super computer (Fujistu, Hitachi, Sun, Intel & others). Intel corporation had built the world's
fastest super-computer with 10240 Intel Pentium CPUs ( more than ten thousand CPUs ) which is
based on a system similar to Linux.

->Linux is 100% POSIX compliant OS, whereas Windows NT/9X are not. POSIX is IEEE (Institute of
Electrical Engg) standard as well as ANSI and international ISO standard spec . U.S. govt
generally require full compliance of POSIX on any operating system. Most of the Unix's like
Solaris, HPUX, AIX, SCO are 100% POSIX.

->We can get the complete source code for Linux OS and all of it's applications, whereas
Windows 9X/NT is proprietary and we get only the binaries. Having the source code of Linux
is vital for companies because they can quickly add advanced features and share it with every
other company in the world.

->Linux is free of any cost. Downside of Windows 9X/ NT is that we need to pay $200 (US dollars) per
seat for Windows 95 and $800 (US dollars) per seat for Windows NT. And Microsoft applications like MS
Office, C++ compilers and others will cost further $400,000 US dollars. It is better to spend money on
hardware and use Linux as the software.

->Linux is trouble free and we will not have any problems with Linux, whereas you will
have more headaches with Windows 95/NT (MS is not as reliable as Linux).

->Linux more than 900 software packages on CDROM and many more are being
developed world-wide. All the software packages are in a single Linux CDROM.

->Linux was awarded The best Network Operating system 1997/98/99/2000 , by any Computer
magazines (US InfoWorld, European publications).

->The movie Titanic was created using Linux on Digital Alpha. Linux was used to create computer
graphics, animations of all the shots in the movie Titanic.

->Linux was also used for storing data from experiments in the space shuttle. Linux was orbiting the
earth in space.

Advantages of Linux
Virus proof

Advanced OS

Crash proof

Economical

Secured

User friendly GUI

Multi-user

Multi-tasking

Multi-desktop

Powerful networking

Variety of servers
WHERE LINUX IS USED
Linux has mostly been used in small to medium-sized companies and is now on its way to being used in
larger-sized companies. In a survey run by Networking Computer Magazine, 75% of respondents were
already using Linux and another 14% were evaluating it (Where is it Used?, 2001). In addition, Linux
servers account for a majority of the information available on the Internet. A survey run by Netcraft
reports that 43% of all web sites use Linux servers running the Apache Web server (Where is it Used?,
2001). Indeed, Linux is truly revolutionizing the corporate world.

HOW LINUX IS USED

Linux is a versatile operating system that was initially the sole domain of computer science students, but
now there is an estimated five to six million machines worldwide running Linux to cut costs and improve
performance. Linux can be used in a myriad of ways such as: a personal workstation, as a file or print
server, as the basis of an embedded system (such as a smart VCR or a robot), as a three-tier client or
server, and as a turnkey system. In addition, Linux is used by Internet Service Providers (ISPs) to provide
information and services to the Internet on the World Wide Web (Hall, 1999, p. 13). Lets take a closer
look at a few of these.

A. Personal Workstation

Linux is a very powerful operating system that can handle a great deal of multitasking. With Linux as an
operating system, one can run many programs simultaneously, handle multiple users at one time, and
use high quality graphics. Linux can also handle large files and programs. For example, when Linux is
used with the 64-bit Digital Alpha processor, it can handle terabytes of data, which is thousands of
billions of characters in size. Linux can also share files with UNIX systems, Microsoft Windows, OS/2 and
other operating systems with its windowing system called X Window System (also known as X Windows,
X11, or plainly X). Similar to Windows, Linux also includes an office suite application. Furthermore, if
the numerous freeware programs are not enough to fulfill your needs, commercial applications such as
databases, data manipulation programs, and office suites are available as well. Linux allows you to work
in the same environment on your notebook computer, desktop workstation, and large server system
(Hall, 1999, p. 13-14).

B. File and Print Server

Linuxs multitasking capability, virtual memory, and powerful file system allows it to work well as a file
and print server for Microsoft Windows systems (Hall, 1999, p. 14). For example, SAMBA allows PCs to
communicate with file systems and with printers attached to a machine running Linux, similar to
AppleTalk allowing file and print sharing for Apple computers. SAMBA was developed by Andrew
Tridgell at the Australian National University in Canberra. SAMBA can support Server Message
Block/NetBios on TCP/IP for file and print server operations (SAMBA. Overview of Linux. Advanced
Horizons. 11/9/02). Additionally, Linux can also share files and printers with UNIX systems. Using Linux
can help save costs because the software and the operating systems provided by these services are free
and readily available (Hall, 1999, p. 14).

C. Internet/Intranet Service Provider

Both the Internet and intranets require similar services that can be delivered by Internet Service
Providers (ISPs) to its customers through Linux. Linux provides services such as:

Firewalls for security


FTP so that files and software can be shared
Telnet so that users can remotely log on to machines
Web servers so that users can access Web pages
NFS to share files over the network

Because Linux is free software and its source code is readily available, ISPs like to use Linux to deliver the
services to their customers because it can be customized. When problems arise, ISPs can take
advantage of this Linux free software, and use it as a tool to correct the problems, instead of having to
wait for a commercial software vendor to develop software to fix the problems (Hall, 1999, p. 14).

D. Three-tier Client/Server

Three-tier client/server deals with three different data operation layers. Simply put, three-tier
client/server means that most computer problems can be broken down into three separate levels:

Data storage and retrieval


Data manipulation
Data presentation

In Microsoft Windows, the data presentation level consists of systems like Visual Basic running on the
desktop to develop the user interface. The data manipulation level and the data storage and retrieval
level consist of UNIX or older systems communicating over the network. On the other hand, a Linux
system running a freely distributed web browser or a freely distributed Java system can be used at the
presentation level as well. Using Linux can save companies from high operating system costs and
companies can also receive required security and operating system robustness.

Linux also has sophisticated data manipulation tools that make it a good second-tier system. Linux can
extract data or reports from different types of databases kept in files of older systems. But not only
that, it can then sort, search, combine, process and manipulate data transferring the newly created
results to the presentation level on the desktop. Furthermore, Linux has the amenities to act as a good
data storage and retrieval level. Linux can work with many different commercial database packages. If
you cannot afford a commercial database package, one can be ordered and used freely from Linux, such
as Postgres. Basically, the purpose of the three-tier concept is to divide work logically, and once that is
accomplished, put all three levels functioning on one computer a Linux system (Hall, 1999, p. 15-16).

E. Turnkey System

A turnkey system is a computer system that has been customized for a particular application. The term
comes from the idea that the end user can just turn a key and the system is ready to go. Turnkey
systems include all the hardware and software necessary for the particular application. They are usually
developed by OEMs (original equipment manufacturers) who buy a computer from another company
and then add software and devices themselves (Turnkey System, 2002, Webopedia.com).

A turnkey system is put together once, and then duplicated in hundreds of different places. Examples of
turnkey systems include: information kiosks, hotel reservation systems, doctor and lawyer office
systems, and automotive diagnostic systems. Because Linux provides the security, protection, and
stability that turnkey systems need, Linux is perfect for this type of work (Hall, 1999, p. 16).

INSTALLATION OF LINUX (KALI LINUX)

Kali Linux Installation Requirements


Installing Kali Linux on your computer is an easy process. First, youll need compatible
computer hardware. Kali is supported on i386, amd64, and ARM (both armel and armhf)
platforms. The hardware requirements are minimal as listed below, although better
hardware will naturally provide better performance. The i386 images have a default PAE
kernel, so you can run them on systems with over 4GB of RAM. Download Kali Linux and
either burn the ISO to DVD, or prepare a USB stick with Kali Linux Live as the installation
medium. If you do not have a DVD drive or USB port on your computer, check out the Kali
Linux Network Install.
Installation Prerequisites

A minimum of 20 GB disk space for the Kali Linux install.


RAM for i386 and amd64 architectures, minimum: 1GB, recommended: 2GB or more.

CD-DVD Drive / USB boot support

Preparing for the Installation


1. Download Kali linux.

2. Burn The Kali Linux ISO to DVD or Image Kali Linux Live to USB.
3. Ensure that your computer is set to boot from CD / USB in your BIOS.

Kali Linux Installation Procedure


1. To start your installation, boot with your chosen installation medium. You should be
greeted with the Kali Boot screen. Choose either Graphical or Text-Mode install. In
this example, we chose a GUI install.

2. Select your preferred language and then your country location. Youll also be
prompted to configure your keyboard with the appropriate keymap.
3. Specify your geographic location.

4. The installer will copy the image to your hard disk, probe your network interfaces,
and then prompt you to enter a hostname for your system. In the example below,
weve entered kali as our hostname.

5. You may optionally provide a default domain name for this system to use.
6. Next, provide a full name for a non-root user for the system.
7. A default user ID will be created, based on the full name you provided. You can
change this if you like.

8. Next, set your time zone.

Partitions
The MBR, boot sectors and partition table

The information about how a hard disk has been partitioned is stored in its first sector (that is, the first
sector of the first track on the first disk surface). The first sector is the master boot record (MBR) of
thedisk; this is the sector that the BIOS reads in and starts when the machine is first booted. The master
bootrecord contains a small program that reads the partition table, checks which partition is active (that
is, marked bootable), and reads the first sector of that partition, the partitions boot sector (the MBR is
also a boot sector, but it has a special status and therefore a special name). This boot sector contains
another small program that reads the first part of the operating system stored on that partition
(assuming it is bootable), and then starts it.

The partitioning scheme is not built into the hardware, or even into the BIOS. It is only a convention that
many operating systems follow. Not all operating systems do follow it, but they are the exceptions.
Some operating systems support partitions, but they occupy one partition on the hard disk, and use
their internal partitioning method within that partition. The latter type exists peacefully with other
operating systems (including Linux), and does not require any special measures, but an operating system
that doesnt support partitions cannot co-exist on the same disk with any other operating system.

As a safety precaution, it is a good idea to write down the partition table on a piece of paper, so that if it
ever corrupts you dont have to lose all your files. (A bad partition table can be fixed with fdisk).

The relevant information is given by the fdisk -l command:

$ fdisk -l /dev/hda

Disk /dev/hda: 15 heads, 57 sectors, 790 cylinders

Units = cylinders of 855 * 512 bytes

Device Boot Begin Start End Blocks Id System

/dev/hda1 1 1 24 10231+ 82 Linux swap

/dev/hda2 25 25 48 10260 83 Linux native

/dev/hda3 49 49 408 153900 83 Linux native

/dev/hda4 409 409 790 163305 5 Extended

/dev/hda5 409 409 744 143611+ 83 Linux native

/dev/hda6 745 745 790 19636+ 83 Linux native

Extended and logical partitions


The original partitioning scheme for PC hard disks allowed only four partitions. This quickly turned out to
be too little in real life, partly because some people want more than four operating systems (Linux, MS-
DOS, OS/2, Minix, FreeBSD, NetBSD, or Windows/NT, to name a few), but primarily because sometimes
it is a good idea to have several partitions for one operating system. For example, swap space is usually
best put in its own partition for Linux instead of in the main Linux partition for reasons of speed.

To overcome this design problem, extended partitions were invented. This trick allows partitioning a
primary partition into sub-partitions. The primary partition thus subdivided
is the extended partition; the subpartitions are logical partitions. They behave like primary 6 partitions,
but are created differently. There is no speed difference between them.The partition structure of a hard
disk might look like that in Figure. The disk is divided into three primary partitions, the second of which
is divided into two logical partitions. Part of the disk is not partitioned at all. The disk as a whole and
each primary partition has a boot sector.

Partition types
The partition tables (the one in the MBR, and the ones for extended partitions) contain one byte per
partition that identifies the type of that partition. This attempts to identify the operating system that
uses the partition, or what it uses it for. The purpose is to make it possible to avoid having two operating
systems accidentally using the same partition.

However, in reality, operating systems do not really care about the partition type byte; e.g., Linux
doesnt care at all what it is. Worse, some of them use it incorrectly; e.g., at least some versions of DR-
DOS ignore the most significant bit of the byte, while others dont.

There is no standardization agency to specify what each byte value means.The same list is available in
the Linux fdisk program.

Partitioning a hard disk


There are many programs for creating and removing partitions. Most operating systems have their own,
and it can be a good idea to use each operating systems own, just in case it does something unusual
that the others cant. Many of the programs are called fdisk, including the Linux one, or variations
thereof.

Details on using the Linux fdisk are given on its man page. The cfdisk command is similar to fdisk, but has
a nicer (full screen) user interface.

When using IDE disks, the boot partition (the partition with the bootable kernel image files) must be
completely within the first 1024 cylinders. This is because the disk is used via the BIOS during boot
(before the system goes into protected mode), and BIOS cant handle more than 1024 cylinders. It is
sometimes possible to use a boot partition that is only partly within the first 1024 cylinders. This works
as long as all the files that are read with the BIOS are within the first 1024 cylinders. Since this is difficult
to arrange, it is a very bad idea to do it; you never know when a kernel update or disk defragmentation
will result in an unbootable system. Therefore, make sure your boot partition is completely within the
first 1024 cylinders.

Some newer versions of the BIOS and IDE disks can, in fact, handle disks with more than 1024 cylinders.
If you have such a system, you can forget about the problem; if you arent quite sure of it, put it within
the first 1024 cylinders.

Each partition should have an even number of sectors, since the Linux filesystems use a 1 kilobyte block
size, i.e., two sectors. An odd number of sectors will result in the last sector being unused. This wont
result in any problems, but it is ugly, and some versions of fdisk will warn about it.
Changing a partitions size usually requires first backing up everything you want to save from that
partition (preferably the whole disk, just in case), deleting the partition, creating new partition, then
restoring everything to the new partition. If the partition is growing, you may need to adjust the sizes
(and backup and restore) of the adjoining partitions as well.

Since changing partition sizes is painful, it is preferable to get the partitions right the first time, or have
an effective and easy to use backup system. If youre installing from a media that does not require much
human intervention (say, from CD-ROM, as opposed to floppies), it is often easy to play with different
configuration at first. Since you dont already have data to back up, it is not so painful to modify
partition sizes several times.

There is a program for MS-DOS, called fips, which resizes an MS-DOS partition without requiring the
backup and restore, but for other filesystems it is still necessary.

Device files and partitions


Each partition and extended partition has its own device file. The naming convention for these files is
that a partitions number is appended after the name of the whole disk, with the convention that 1-4
are primary partitions (regardless of how many primary partitions there are) and 5-8 are logical
partitions (regardless of within which primary partition they reside). For example, /dev/hda1 is the first
primary partition on the first IDE hard disk, and /dev/sdb7 is the third extended partition on the second
SCSI hard disk.

9. The installer will now probe your disks and offer you four choices. In our example,
were using the entire disk on our computer and not configuring LVM (logical volume
manager). Experienced users can use the Manual partitioning method for more

granular configuration options.


10. Select the disk to be partitioned.

11. Depending on your needs, you can choose to keep all your files in a single partition
the default or to have separate partitions for one or more of the top-level
directories. If youre not sure which you want, you want All files in one partition.
12. Next, youll have one last chance to review your disk configuration before the
installer makes irreversible changes. After you click Continue, the installer will go to
work and youll have an almost finished installation.
13. Configure network mirrors. Kali uses a central repository to distribute applications.
Youll need to enter any appropriate proxy information as needed.
NOTE! If you select NO in this screen, you will NOT be able to install packages
from Kali repositories.

FILE SYSTEM WITH SHELL AND KERNEL IN LINUX

A Linux system is basically divided in three major components: File System (LFS), Shell and
Kernel. Kernel is the core program which manage system hardware devices. Shell provides user
interface to run the commands. File system organizes the data in systematic way. Collectively
LFS, Shell and kernel provides a way to interact with system and an environment to run
commands and manage data.

Linux File System (LFS)


Linux accesses every object as file. Files are systematically organized in directories. Linux starts
file system with root directory(/). All files and directories are created and managed under the
root directory. Since root directory stands on the top in file system, it has no parent directory.
Besides root directory, every directory in Linux has a parent directory. Linux allows us to create
as many files and directories as we want. We can create files under the existing directories or
may create new directories.

System Directories
System directories contain files, software, applications and scripts which are required to run
and maintain the Linux. System directories are automatically created during the installation.
Following figure illustrates some common system directories with their location in LFS.

Common System directories


Directory Description

First directory in Linux File System. It is also known as root directory or main
/
directory. All files and directories are created and managed under this directory.
Default directory for user data. Whenever we add a new user, Linux automatically
/home creates a home directory matching with his username in this directory. Whenever user
login, Linux starts his login session from home directory.

This is the home directory for root user. Root user is the super user in Linux. For
/root security reason Linux creates a separate home directory for root user. Root user
account is also being created during the installation automatically.

This directory contains standard commands files. Commands stored in this directory
/bin
are available for all users and usually do not require any special permission to run.

This directory contains system administration commands files. Commands stored in


/sbin this directory are available only for root user and usually requires special privilege to
run.

This directory contains user application software files, third party software and scripts,
/usr
document files and libraries for programming languages.

/var This directory stores variable data files such as printing jobs, mail box etc.

/etc This directory contains system configuration files.

/boot This directory contains Linux boot loader file.

This directory is used to mount remote file system and temporary devices such as CD,
/mnt
DVD and USB.

This directory contains device files. Usually files in this directory are dynamically
/dev
generated and should be never edited.

/tmp This directory provides temporary location for applications.

Exercise -1
List all directories from root directory.

Solution
ls / command will list all directories from root directory.

Linux File Naming Convention


Unlike Windows operating system Linux is not strict with naming convention. We can use any
number or letter for file name. We can also use underscore, space, period and comma. Some
special characters such as question mark, asterisks and slashes are not allowed for file name.
These characters are reserved for shell functions. Just like Windows we can use dot to create a
file extension. File extensions are not compulsory in Linux but we should use them wherever
possible as they provide a good way to manage files.

Key points

A Linux file name may have any characters or letters.


Maximum length for file name is 256 characters.
File name can use space, underscore, minus, period and comma.
File name cannot use question marks, asterisks and slashes.
File extension is not compulsory. We can create files with file extension or
without file extension.
To create a hidden file, start its name with dot.
If file name has spaces, it need to be quoted before we can access it on
command prompt. On desktop we can use it without quotes.

Exercise -2
Create a test directory and move in it. Create blank files with following names:-
test, test.doc, test.docx, test-file, test_file, test.file, test file (test file at command prompt),
.test-file (hidden file)
Verify the file creation. Verify the hidden file. Exit from directory and delete the directory.

Solution

Create new directory from mkdir command.


Use cd command to move in directory.
Use touch command to create files. touch command creates blank file. It
accept multiple files name. File name would be separated by a space. Shell
use space to parse arguments on command line. We can create multiple
files with single command by separating file name s with space. If a file
name has space in it, we have to quote it.
To create a hidden file start its name with dot ( .).
Use ls command to list the files of current directory.
Use ls command with a
option to list hidden files.
Use cd .. command to return
in parent directory.
Use rm rf command to
delete the directory with all
files.

Shell
Shell is a command interpreter. It take
commands from user, execute them
and display the results. Shell supports
I/O ( Input / Output) redirection which means it can read commands from non-standard
sources such as script files. As well as it can also redirect output to any supportive device (such
as printer) or data server.
Several Shells are available in Linux such as Kom, TCSH, Z shell, Bash etc. Although several shells
are available, only one shell is set to default in RedHat Linux. Bash (Bourne Again shell) shell is
the default shell in Red-Hat Linux.
Command Description

cat /etc/shells To list the all available shells

chsh l To list the all available shells

echo $0 To view the current shell name

exec /bin/csh To change current shell temporary. At next login default shell will be restored.

chsh s To change current shell permanently. Change will be applied at next login. Default
/bin/csh shell will be used in current session.

Exercise -3
View the current shell and list all available shells. Change current shell temporary for this login
session and verify the change. Logout from current session and login again and verify that
default shell get restored. Change shell again but this time change it permanently.

Solution

To view the current shell use echo $0 command. To list all available shells either use cat
/etc/shells or use chsh l command.
To change current shell temporary use exec /bin/csh command. This command will change
current shell to csh. This change will be temporary. It will be lost with current session. To verify
this terminate the current session with exit command. Login again and view the current shell. It
should be restored with default shell.

To change the current shell permanently use chsh s /bin/csh command. Change will take
place at next login.

Kernel
Kernel is the core application in Linux operating system. It communicates directly with system
devices such as memory, CPU, CDROM, Hard disk etc.
When a user wants to access any device, he types appropriate command at command prompt.
Shell interpreters the command and hands over the instruction to kernel. Kernel communicates
with device and process the user requests.
Kernel name provides information about its version. Kernel version number is built from four
segments : major, minor, revision, and security / bug fix.

Major number :- This number reflects major changes in kernel.


Minor number :- This number reflects a major revision in kernel.
Revision number :- This number reflects that new supporting features
are added in kernel.

Security/ Bug number :- This number reflects security or bug fix in


kernel.

Kernel development is an ongoing process.


Development versions will first available as
release candidates. Release Candidates (rc) are
intended for developers. RC allows developers to
test new features of kernel before final version is
released. Release candidate have an indicative
keyword (rc) in name for example kernel-2.6.22-
rc3.
Kernel is an open source project. Distributors are
allowed to make changes in kernel. If distributer
makes any change in kernel, he will add a patch
number in the end of the name. Besides patch number, distributors may add platform number.

To view which kernel package is install, we can use rpm q kernel


command.
To view only the kernel version number we can use uname r command.

MANAGING USERS AND GROUPS


Managing Unix Users and Unix Groups
The database of Unix users and groups consists of the textual files /etc/passwd (list of users),
/etc/shadow(encrypted passwords of users), /etc/group (list of groups), and /etc/gshadow
(encrypted passwords of groups). Their formats are documented in passwd(5), shadow(5),
group(5), and gshadow(5) respectively. While these files can be manually edited with tools like
vipw and vigr, there are higher level tools to perform the most common operations.
Using getent to Consult the User Database
The getent (get entries) command checks the system databases (including those of users and
groups) using the appropriate library functions, which in turn call the name service switch (NSS)
modules configured in the /etc/nsswitch.conf file. The command takes one or two arguments: the
name of the database to check, and a possible search key. Thus, the command getent passwd
kaliuser1 will return the information from the user database regarding the user kaliuser1.

1 root@kali:~# getent passwd kaliuser1

2 kaliuser1:x:1001:1001:Kali User,4444,123-867-5309,321-865309:/home/kaliuser1:/bin/bash

Creating User Accounts


Although Kali is most often run while authenticated as the root user, you may often need to create
non-privileged user accounts for various reasons, particularly if you are using Kali as a primary
operating system. The most typical way to add a user is with the adduser command, which takes a
required argument: the username for the new user that you would like to create.
The adduser command asks a few questions before creating the account but its usage is fairly
straightforward. Its configuration file, /etc/adduser.conf, includes many interesting settings. You
can, for example, define the range of user identifiers (UIDs) that can be used, dictate whether or
not users share a common group or not, define default shells, and more.
The creation of an account triggers the population of the user's home directory with the contents of
the /etc/skel/ template. This provides the user with a set of standard directories and configuration
files.
In some cases, it will be useful to add a user to a group (other than their default main group) in
order to grant additional permissions. For example, a user who is included in the sudo group has full
administrative privileges through the sudo command. This can be achieved with a command such as
adduser user group.

Modifying an Existing Account or Password


The following commands allow modification of the information stored in specific fields of the user
databases:

passwdpermits a regular user to change their password, which in turn, updates the /etc/shadow file.
chfn(CHange Full Name), reserved for the super-user (root), modifies the GECOS, or "general
information" field.
chsh(CHange SHell) changes the user's login shell. However, available choices will be limited to those
listed in /etc/shells; the administrator, on the other hand, is not bound by this restriction and can set the
shell to any program chosen.
chage(CHange AGE) allows the administrator to change the password expiration settings by passing the
user name as an argument or list current settings using the -l user option. Alternatively, you can also force
the expiration of a password using the passwd -e user command, which forces the user to change their
password the next time they log in.

Disabling an Account
You may find yourself needing to disable an account (lock out a user) as a disciplinary measure, for
the purposes of an investigation, or simply in the event of a prolonged or definitive absence of a
user. A disabled account means the user cannot login or gain access to the machine. The account
remains intact on the machine and no files or data are deleted; it is simply inaccessible. This is
accomplished by using the command passwd -l user(lock). Re-enabling the account is done in
similar fashion, with the -u option (unlock).

Managing Unix Groups


The addgroup and delgroup commands add or delete a group, respectively. The groupmod
command modifies a group's information (its gid or identifier). The command gpasswd group
changes the password for the group, while the
gpasswd -r group command deletes it.

Working with Several Groups

Each user may be a member of many groups. A user's main group is, by default, created during
initial user configuration. By default, each file that a user creates belongs to the user, as well as to
the user's main group. This is not always desirable; for example, when the user needs to work in a
directory shared by a group other than their main group. In this case, the user needs to change
groups using one of the following commands: newgrp, which starts a new shell, or sg, which simply
executes a command using the supplied alternate group. These commands also allow the user to
join a group to which they do not currently belong. If the group is password protected, they will
need to supply the appropriate password before the command is executed.

Alternatively, the user can set the setgid bit on the directory, which causes files created in that
directory to automatically belong to the correct group. For more details, see SECURITY setgid
directory and sticky bit.
The id command displays the current state of a user, with their personal identifier (uid variable),
current main group (gid variable), and the list of groups to which they belong (groups variable).

Steps

1) Open the terminal and check network interface file .


2) Edit "/etc/network/interfaces" file.

orca@omura:~$ sudo gedit /etc/network/interfaces


3) Disable "dhcp" and update the network static IP address information in the file and "save"
4) Refresh the connection by running "ifdown eth0" to turn off the network interface and "ifup
eth0" command to turn on the network interface .

orca@omura:~$ sudo ifdown eth0


orca@omura:~$ sudo ifup eth0

5) Kali Linux should run on static IP address .

You might also like