Professional Documents
Culture Documents
MAINTENANCE
Schedule
Course Schedule
Grading Guidelines
30% Mid-Sem exam (with 15% online 60 minutes +15%
remote 60 minutes)
References
UNIX
History of UNIX
History of UNIX
History of UNIX
What is LINUX
LINUX Distributions
Mandrake: http://www.mandrakesoft.com/
RedHat: http://www.redhat.com/
Fedora: http://fedora.redhat.com/
SuSE/Novell: http://www.suse.com/
Debian: http://www.debian.org/
Red Hat Enterprise Linux is a Enterprise targeted Operating
System. It based on mature Open Source technology and available
at a cost with one year Red Hat Network subscription for upgrade
and support contract.
Refer https://www.howtogeek.com/191207/10-of-the-most-popular-linux-distributions-
compared/ for comparison of various linux distros.
Introduction to Linux
UNIX Structure
Introduction to Linux
UNIX Structure
Kernel − The kernel is the heart of the operating system. It interacts
with the hardware and most of the tasks like memory management, task
scheduling and file management.
Shell − The shell is the utility that processes your requests. When you
type in a command at your terminal, the shell interprets the command
and calls the program that you want. C Shell, Bourne Shell and Korn
Shell are the most famous shells
Commands and Utilities − There are various commands and utilities
which you can make use of in your day to day activities. cp, mv, cat and
grep, etc. are few examples of commands and utilities. There are over
250 standard commands plus numerous others provided through 3rd
party software. All the commands come along with various options.
Files and Directories − All the data of Unix is organized into files. All
files are then organized into directories. These directories are further
organized into a tree-like structure called the filesystem.
Introduction to Linux
File System
File System
Each node is either a file or a directory of files,
where the latter can contain other files and
directories.
You specify a file or directory by its path name,
either the full, or absolute path name or the one
relative to a location.
The full path name starts with the root, /, and
follows the branches of the file system, each
separated by /, until you reach the desired file, e.g.:
/home/vijay/source/xntp
Introduction to Linux
File System
Access Permissions
There are three permissions for any file, directory
or application program.
Access Permissions
Each of the three permissions are assigned to three
defined categories of users.
The categories are:
Access Permissions
One can easily view the permissions for a file by
invoking a long format listing using the command
ls -l.
Access Permissions
The permissions for this file are listed at the start
of the line, starting with rwx.
Access Permissions
This listing indicates that the file is readable,
writable, and executable by the user who owns the
file (user juan) as well as the group owning the file
(which is a group named student).
$ ls –l
Introduction to Linux
Moving in Directories
cd try_it
Changes the directory to try_it
pwd
Prints present working directory
(e.g./home/smith/try_it)
cd .. Move to superior directory
pwd : Prints /home/smith
cd /home The absolute path
pwd : Prints /home
cd: The system is returned to the user home directory
pwd : Prints /home/smith
Introduction to Linux
Make Directory
Remove Directory
Copy File
Remove File
The command rm file_a
removes the file_a from the system
If you use wildcard. For example
rm h*c
you will remove all files beginning with h and
ending with c which are in working directory.
If you write
rm *
you will erase all files from your working directory.
Introduction to Linux
Assignment
Login as guest (password is guest)
Find the present Directory
Write the root directory structure
Write a few commands available in /bin and /sbin directory
Find the guest directory
Write the permissions of guest directory
Create a new Directory test in guest directory
Copy the file /etc/resolv.conf in test directory
Rename the test directory to testing
Delete the testing directory
Change the permissions of guest directory to 700
Change the permissions of /tmp directory to 700
Linux Installation
LINUX INSTALLATION
(Ubuntu)
Vijay Ukani
Linux Installation
Download LINUX
Installation Type
• Erase Disk and Install Ubuntu
• Encrypt the new Ubuntu installation for
security
• Use LVM with the new Ubuntu installation
• Something Else
– /boot 2 GB (ext4 files system)
– /home 18 GB (ext4 file system)
–/ 12 GB (ext4 file system)
– /var 6 GB (ext4 file system)
– Swap 4 GB
Linux Installation
Installation Type
Linux Installation
Installation Type
Linux Installation
Installation Type
Linux Installation
Installation Type
Linux Installation
Installation Type
Linux Installation
Installation Type
Linux Installation
Installation Type
Linux Installation
Installation Type
Linux Installation
Time Zone
Linux Installation
User Credentials
Linux Installation
Continue Install
Linux Installation
Restart
Linux Installation
Install Windows
Linux Installation
Install Windows
Linux Installation
Install Windows
Linux Installation
Install Windows
Linux Installation
Install Windows
Linux Installation
Install Windows
Linux Installation
Create Partition
Linux Installation
Create Partition
Linux Installation
Install Windows
Linux Installation
Windows Installed
Linux Installation
Install Ubuntu
Linux Installation
Select Partition
Linux Installation
Confirm Partition
Linux Installation
User Creation
Linux Installation
References
• https://www.linuxtechi.com/ubuntu-18-04-
lts-desktop-installation-guide-screenshots/
• https://opensource.com/article/18/5/dual-
boot-linux
Linux Commands
LINUX COMMANDS
Linux Commands
UNIX Commands
A command is a program which interacts with the
kernel to provide the environment and perform the
functions called for by the user.
UNIX Shell
The shell sits between you and the operating
system, acting as a command interpreter.
UNIX Shell
The original shell was the Bourne shell, sh.
Every Unix platform will either have the Bourne shell,
or a Bourne compatible shell available.
The default prompt for the Bourne shell is $ (or #,
for the root user).
Another popular shell is C Shell. The default prompt
for the C shell is %.
Linux Commands
UNIX Shell
Numerous other shells are available from the
network. Almost all of them are based on either sh
or csh with extensions to provide job control to sh,
allow in-line editing of commands, page through
previously executed commands, provide command
name completion and custom prompt, etc.
Some of the more well known of these may be on
your favorite Unix system: the Korn shell, ksh, by
David Korn and the Bourne Again SHell, bash, from
the Free Software Foundations GNU project, both
based on sh, the T-C shell, tcsh, and the extended C
shell, cshe, both based on csh.
Linux Commands
Shell Programming
You can write shell programs by creating scripts
containing a series of shell commands.
Shell Programming
The first line is followed by commands
Within the scripts # indicates a comment from that
point until the end of the line, with #! being a
special case if found as the first characters of the
file.
#!/bin/bash
cd /tmp
mkdir t
Yo u a l s o n e e d t o s p e c i f y t h a t t h e s c r i p t i s
executable by setting the proper bits on the file
with chmod, e.g.:
$ chmod +x shell_script
Linux Commands
LINUX COMMANDS
File Management and Viewing
Filesystem Mangement
Help, Job and Process Management
Network Management
System Management
User Management
Printing and Programming
Document Preparation
Miscellaneous
Linux Commands
Command Structure
Command <Options> <Arguments>
Multiple commands separated by ; can be executed
one after the other
Linux Commands
Pipes
An important early development in Unix was the
invention of "pipes," a way to pass the output of
one tool to the input of another.
eg. $ who | wc −l
By combining these two tools, giving the wc
command the output of who, you can build a new
command to list the number of users currently on
the system
Linux Commands
System Time
File System
Each OS needs to store data/files on secondary storage like HDD
as it is not possible to store everything on volatile storage like
RAM as it is costly and can not maintain the contents after being
powered down.
A filesystem is designed to manage space for non-volatile storage
of data.
File system is a method for storing and organizing computer files
and the data they contain to make it easy to find and access
them.
Most file systems make use of an underlying data storage device
such as Hard Disks that offers access to an array of fixed-size
blocks which is the smallest logical amount of disk space that can
be allocated to hold a file.
File System
File System
Other important features of file systems:
A namespace—that is, a naming and organizational
methodology includes length and set characters that can
be used
A metadata structure - data structure to support directory
hierarchy, memory block, name of file, size, timestamp.
An API - provides access to system function calls which
manipulate filesystem objects like files and directories,
creating, deleting, and moving files.
Security model - access rights to files/directories
Software required to implement these functions
File System
File System
Directory Structure
File System
Directory Structure
Directory Description
/ (root fs) The root filesystem is the top-level directory of the filesystem.
/bin The /bin directory contains user executable files.
/boot Contains the static bootloader and kernel executable and
configuration files required to boot
/dev device files for every hardware device.
/etc local system configuration files for the host computer
/home Each user has a subdirectory in /home.
/lib shared library files that are required to boot the system.
/media place to mount external removable media devices such as
USB thumb drives that may be connected to the host.
/mnt A temporary mountpoint for regular filesystems
/opt Optional files such as vendor supplied application programs
should be located here
/root not the root (/) filesystem but home directory for root user
/var Variable data files are stored here
File System
FAT
The File Allocation Table (FAT) file system was
initially developed for DOS Operating System and
was later used and supported by all versions of
Microsoft Windows.
All the latest versions of Windows still support FAT
file system although it may not be popular.
FAT had various versions like FAT12, FAT16 and
FAT32. Numbers indicate the number of address bits
in the table: 12, 16 and 32.
FAT16 supports HDD from 16MB to 2GB
FAT32 supports larger HDD upto 32GB
Windows File System
NTFS
NTFS or the NT File System was introduced with the
Windows NT operating system.
NTFS allows ACL-based permission control which was
the most important feature missing in FAT File System.
L a t e r v e r s i o n s o f Wi n d o w s l i ke Wi n d o w s 2 0 0 0 ,
Windows XP, Windows Server 2003, Windows Server
2008, and Windows Vista also use NTFS.
NTFS has several improvements over FAT such as
security access control lists (ACL) and file system
journaling.
Supports large files 216 bytes with HDD upto 256TB
Windows File System
Journaling
A journaling file system is a file system that logs
changes to a journal (usually a circular log in a
dedicated area) before committing them to the main
file system. Such file systems are less likely to become
corrupted in the event of power failure or system crash.
Linux File System
Application Software
Application software is a software tool that functions
with the purpose of supporting or improving the user's
work.
Typical examples of software applications are word
processors, spreadsheets, media players, database
applications etc.
Application Software are usually available for a
particular Operating System and hardware platform for
which it has been compiled.
Application Software may be freely downloadable or
paid. Paid software would have licensing policy which
may be perpetual or time bound and may also be
restricted to certain number of users.
Application Software
API
An application programming interface (API) is a set
of routines, data structures, object classes and/or
protocols provided by libraries and/or operating
system services in order to support the building of
applications.
An API may be Language-dependent or Language-
independent.
Companies make their APIs freely available. For
example, Microsoft makes the Microsoft Windows API
and the Micrososft Windows Software Development
Kit (SDK), public so that software can be written for
their platform.
Application Software
Client-Server Applications
The client-server software
architecture model distinguishes
client systems from server systems,
which communicate over a computer
network.
A client-server application is a
distributed system comprising of
both client and server software. The
client software may be a browser.
A client software process may
initiate a communication session,
while the server waits for requests
from any client.
Application Software
Peer-to-Peer Applications
There is no notion of clients or servers but only
equal peer nodes that simultaneously function as
both “clients” and “servers”
File sharing (containing audio, video, data) is the
most common application of P2P networks
Some applications like Torrent may start as Client-
server application (for searching the data) and
then change over to peer-to-peer applications
(downloaded the content from another peer).
The advantage is that multiple nodes contribute
their resources and the architecture is robust as
the content may be available on multiple nodes so
that the failure of a node will not affect the system.
Application Software
References
https://opensource.com/life/16/10/introduction-
linux-filesystems
Linux System Administration
Dr Vijay Ukani
Desktop Configuration
auto enp4s0
iface enp4s0 inet static
address 10.1.32.5
gateway 10.1.19.27
netmask 255.255.0.0
network 10.1.0.0
broadcast 10.1.255.255
Linux System Administration
host Command
host - display information on hosts or domains
whois Command:
Query specific domain name information
eg. whois google.com
Access Control List (ACL)
• ACLs are widely used in computer networking and in network
security for mitigating network attacks and controlling network traffic.
• ACLs are used to define and control classes of traffic on networking
devices based on various parameters of layer 2,3,4, and 7
• Virtually any type of traffic can be defined explicitly by using an
appropriately Numbered ACL. For example, in the past, the Ethernet
type field of an Ethernet frame header was used to define certain
types of traffic. An Ethernet type of 0x8035 indicated a reverse
address resolution protocol (RARP) frame. Numbered ACLs with a
range of 200-299 were used to control traffic according to Ethernet
type.
• ACLs based on MAC address - 700-799
• Standard IP ACL – 1-99 and 1300-1999
• Extended IP ACL – 100-199 and 2000-2699
ACL Topology
Primary reasons
• Limit network traffic and increase
network performance.
• Provide traffic flow control. ACLs can
restrict the delivery of routing updates.
• Provide a basic level of security for
network access.
• Decide which types of traffic are
forwarded or blocked at the router
interfaces.
• Like: e-mail traffic to be routed, but
block all Telnet traffic.
An ACL is made up of
statements that define whether
packets are accepted or
rejected at inbound and
outbound interfaces.
inbound and outbound
interfaces
Extended
Applying Standard ACLs
Use a standard ACL to block all traffic from 172.16.4.0/24 to 172.16.3.0
network, but allow all other traffic.
r1
r1
Service Configuration
(http, squid, ftp, ssh, cups, smtp, nfs,
nis, samba)
Web Server Setup
Linux Services
Manage Services
To start a service
sudo systemctl start [service_name]
To stop a service
sudo systemctl stop [service_name]
To check the status of a service
sudo systemctl status [service_name]
Run a service while the OS is being loaded:
sudo systemctl enable [service_name]
Remove from initial load
sudo systemctl disable [service_name]
To install a service
sudo apt install net-tools
yum install net-tools
Web Server Setup
http service
Apache Configuration
Website content is stored in the /var/www/html/ directory
Apache creates log files for any errors it generates in the file
/var/log/apache2/error.log
It also creates access logs for its interactions with clients in
the file /var/log/apache2/access.log
Apache functions through the use of configuration files.
They are all located in the /etc/apache2/ directory.
Web Server Setup
Apache Configuration
/etc/apache2/apache2.conf – This is the main Apache configuration file
and controls everything Apache does on your system. Changes here
affect all the websites hosted on this machine.
/etc/apache2/ports.conf – The port configuration file. You can
customize the ports Apache monitors using this file. By default, Port 80
is configured for http traffic.
/etc/apache2/sites-available – Storage for Apache virtual host files. A
virtual host is a record of one of the websites hosted on the server.
/etc/apache2/sites-enabled – This directory holds websites that are
ready to serve clients. The a2ensite command is used on a virtual host
file in the sites-available directory to add sites to this location.
Web Server Setup
Basic Settings
Virtual Hosting
Virtual Hosting
Create required directories in /var/www/vu.com and
/var/www/vijayukani.com
Create index.html files both sites
Create Virtual Host configuration files in /etc/apache2/sites-
available directory as vu.com.conf and vijayukani.com.conf for
both the sites (contents of this file on next slide)
Use the a2ensite helper to enable the virtual host file with the
command:
sudo a2ensite vu.com
sudo a2ensite vijayukani.com
Web Server Setup
Virtual Hosting
<VirtualHost *:8080>
ServerAdmin webmaster@vu.com
ServerName vu.com
ServerAlias www.vu.com
DocumentRoot /var/www/vu.com
ErrorLog ${APACHE_LOG_DIR}/vu.com-error.log
CustomLog ${APACHE_LOG_DIR}/vu.com-access.log
combined
</VirtualHost>
Squid Setup
SQUID SETUP
Squid Setup
Obtaining Squid
Source code (in C) from www.squid-cache.org
Binary executables
Linux (comes with RedHat and others)
FreeBSD
Windows
Pre-installed in Fedora/Enterprise Linux
Install using apt
sudo apt-get install squid
Squid Setup
Basic Settings
Edit the /etc/squid/squid.conf file to configure squid
Configuration options:
Disk Cache size and location
Authentication
Allowed Hosts
Any other access restrictions (sites, content, size,
time of access etc.) using ACL
service squid start/stop/restart
Squid Setup
Squid.conf Configuration
cache_dir ufs /var/spool/squid/cache 100 16 256
auth_param basic program /usr/lib/squid/ncsa_auth
/etc/shadow
acl sidbiusers proxy_auth required
http_access allow sidbiusers
acl our_network src 172.28.250.0/24
http_access allow our_network
(Note: use squid –z for the first time to create the
cache directory and its subdirectories)