SlideShare a Scribd company logo
1 of 50
0
N T I
Prepared by: Eng. Anwar Fouad
Linux Fundamentals
1
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
What is Linux?
A fully-networked 32/64-Bit Unix-like Operating System
 Unix Tools Like sed, awk , find, and grep (explained later)
 Compilers Like C, C++, Fortran, …etc.
 Network Tools Like telnet, ftp, ping, traceroute
Multi-user, Multitasking, Multiprocessor
Has the X Windows GUI
Coexists with other Operating Systems
Runs on multiple hardware platforms
Includes the Source Code
2
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
How do you get it?
Download it from the Internet
From a “Distribution” (e.g. Red Hat)
 Linux kernel
 X Windows system and GUI
 Web, e-mail, FTP servers
 Installation & configuration support
 3rd party apps
 Hardware support
3
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Popular Linux Distributions
4
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Why is it significant?
Growing popularity
Powerful
 Runs on multiple hardware platforms
 Users like its speed and stability
 No requirement for latest hardware
It’s “free”
 Licensed under GPL
 Vendors are distributors who package Linux
5
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Linux’s place in the market
Impacts:
 Applications:
 Web servers (65%)
 Web Infrastructure (mail, DNS) (15%)
 File/Print (15%)
 DB & DB Applications (2%)
 Observations
 Linux/Apache share of Web serving high
 Many SMB and small ISP
 Strong mindshare among developers
N T I
Linux Fundamentals
Using the system
N T I
Linux Fundamentals
Linux Command Basics
Working with files and directories
8
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Syntax Of Basic Commands
<command name> [<options>] [<arg1> <arg2> ... <arg n>]
Expressions between brackets [ ] are optional.
<options>: sequence of letters preceded by ‘-’ character.
each letter represents one option.
the order of the options has no importance.
<arg i>: string of characters
its meaning depends on the current command
(usually, they are file pathnames)
<command name>: command name
usually an executable filename.
Different command elements are delimited by at least one space
character.
Linux/Unix is case-sensitive.
9
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Execute a command line
To execute a command, type its name and arguments at the command line
ls -l /etc
Command name
Options
(flags)
Arguments
10
N T I
Prepared by: Eng. Anwar Fouad
File System Finding
11
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Finding and Processing Files
● Use locate
● Use find
12
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
locate
● Queries a pre-built database of paths to files on the system
 Database must be updated by administrator
 Full path is searched, not just filename
● May only search directories where the user has read and execute
permission
13
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
locate Examples
● locate file1
 Search for files with “file1" in the name or path
● Useful options
 -i performs a case-insensitive search
 -n X lists only the first X matches
14
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
find
● find [directory...] [criteria...]
● Searches directory trees in real-time
 Slower but more accurate than locate
 CWD is used if no starting directory given
 All files are matched if no criteria given
● May only search directories where the user has read and execute
permission
15
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Basic find Examples
● find -name snow.png
 Search for files named snow.png
● find -iname snow.png
 Case-insensitive search for files named snow.png,Snow.png, SNOW.PNG, etc
● find -user joe -group joe
 Search for files owned by the user joe and the group joe
16
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
find and Logical Operators
● Criteria are ANDed together by default.
● Can be OR'd or negated with -o and -not
● Parentheses can be used to determine logic order, but must be escaped
in bash.
 find -user joe -not -group joe
 find -user joe -o -user jane
 find -not ( -user joe -o -user jane )
17
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
find and Numeric Criteria
● Many find criteria take numeric values
● find -size 1024k
 Files with a size of exactly 1 megabyte
● find -size +1024k
 Files with a size over 1 megabyte
● find -size -1024k
 Files with a size less than 1 megabyte
18
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
find and Access Times
● find can match by inode timestamps
 -atime when file was last read
 -mtime when file data last changed
 -ctime when file data or metadata last changed
● Value given is in days
 find -ctime -10
Files modified less than 10 days ago
● Value given is in minutes
 find -cmin -60
Files modified less than 1 hour ago
19
N T I
Prepared by: Eng. Anwar Fouad
Storage Management
20
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
What is Software RAID?
● Multiple disks grouped together into "arrays” to provide better
performance, redundancy or both.
● mdadm - provides the administration interface to software RAID.
● Many "RAID Levels" supported, including RAID O, 1 and 5.
● Spare disks add extra redundancy
● RAID devices are named, /dev/md0, /dev/md1, /dev/md2, /dev/md3 and
so on.
21
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Software RAID Configuration
● Create and define RAID devices using mdadm
mdadm -C /dev/md0 -l 1 -n 2 -x 1 /dev/sda1 /dev/sdb1 /dev/sdc1
● Format each RAID device with a filesystem
mke2fs -j /dev/md0
● Test the RAID devices
● mdadm allows you to check the status of your RAID devices
mdadm --detail /dev/md0
22
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Software RAID Testing and Recovery
● Simulating disk failures
mdadm /dev/md0 -f /dev/sda1
● Recovering from a software RAID disk failure
 replace the failed hard drive and power on
 reconstruct partitions on the replacement drive
 mdadm /dev/md0 -a /dev/sda1
● mdadm, /proc/mdstat, and syslog messages
23
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
What is Logical Volume Manager (LVM)?
● A layer of abstraction that allows easy manipulation of
volumes. Including resizing of filesystems
● Allows reorganization of filesystems across multiple
physical devices
24
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
LVM
25
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Creating Logical Volumes
● Create physical volumes
pvcreate /dev/hda3
● Assign physical volumes to volume groups
vgcreate vg0 /dev/hda3
● Create logical volumes from volume groups
lvcreate -L 256M -n data vg0
mke2fs -j /dev/vg0/data
26
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Resizing Logical Volumes
Growing Volumes
 lvextend can grow logical volumes
 vgextend adds new physical volumes to an existing volume group.
● Shrinking volumes
 lvreduce can then reduce the volume.
 Volume Groups can be reduced with:
pvmove /dev/hda3
vgreduce vg0 /dev/hda3
27
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Logical Volume Manager Snapshots
● Snapshots are special Logical Volumes that are an exact copy of an
existing Logical Volume at the time the snapshot is created
● Snapshots are perfect for backups and other operations
where a temporary copy of an existing dataset is needed
● Snapshots only consume space where they are
different from the original Logical Volume
28
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Using LVM Snapshots
● Create Snapshot of existing Logical Volume
# lvcreate -l 64 -s -n databackup /dev/vg0/data
● Mount Snapshot
# mkdir -p /mnt/databackup
# mount -o ro /dev/vg0/databackup /mnt/databackup
● Remove Snapshot
# umount /mnt/databackup
# lvremove /dev/vg0/databackup
N T I
Linux Fundamentals
Backup and restore
30
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Importance of Regular File System Backups
Backing up file systems is one of the most crucial system
administration functions.
Backups should be performed on a regularly scheduled basis to
prevent loss of data due to:
• Accidental deletion of files
• Hardware failures
• Problems when reinstalling or upgrading a system
• System crashes
• System break-in by an unauthorized user compromising data integrity
• Natural disasters
31
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Overview of Backup Methods
 The backup process involves copying data from one
computer to some other reliable storage medium for
safekeeping.
 Once the data has been archived, the system administrator
can then restore data to the system from any previously
recorded backup.
 Considerations that are relevant for storage devices:
 Cost
 Size
 Manageability
 Reliability
32
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Overview of Backup Methods
There are many types of backup procedures that define how the
backup will take place:
 Full - will backup everything on the hard drive at the scheduled point in
the day
 Partial - backs up selected files
 Incremental - only the files that have changed since the last backup
33
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Archiving Tools: tar
● tar can backup to a file or tape device
● supports GZIP and BZIP2 compression
● can preserve file permissions, ownership and timestamps
● supports extended attributes
● uses rmt to write to a remote tape device
34
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Archiving Tools: dump/restore
● Back up and restore ext2/3/4 filesystems
 Does not work with other filesystems
 dump should only be used on unmounted filesystems or filesystems
that are read-only.
● Can do full or incremental backups
● Examples:
dump -0uf /dev/nst0 /dev/hda2
restore -rf /dev/nst0
35
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
The /etc/dumpdates File
Each line in /etc/dumpdates file shows the file system backed up, the level
of the last backup, and the day, date, and time of the backup.
The following is an example of a typical /etc/dumpdates file:
# cat /etc/dumpdates
/dev/sda3 0 Fri Jun 2 19:12:27 2000
/dev/sda1 0 Fri Jun 2 20:44:02 2000
/dev/sda3 5 Thu Jun 8 19:42:21 2000
36
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Backing Up to Tape
1. Become root to bring the system to single-user mode and unmount the file
systems.
# shutdown -v -g30 “System is being shutdown for backup”
Shutdown started. Mon Jun 5 14:05:46 MdT 2000
Broadcast Message from root (pts/1) on host1 Mon Jun 5 14:05:46...
The system host1 will be shut down in 30 minutes
System is being shutdown for backup
2. Unmount all file systems (except / and /usr)
# umount /home
3. Check the integrity of the file system data with the fsck
command, but only if the file system has been unmounted.
# fsck /home
4. Perform a full level 0 backup of the /home file system.
# dump -0uf /dev/rmt/0 /home
DUMP: Writing 32 Kilobyte records
DUMP: Date of this level 0 dump: Mon Jun 5 2000 14:10:15 PM MDT
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping / dev/sda3 (host1:/home) to /dev/rmt/0.
….
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Mon Jun 5 2000 14:10:15 PM MDT
#
37
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Restoring File Systems
Command Format
restore options [ arguments ] [ filesystem ]
restore options [ arguments ] [ filenames . . . ]
Common Options
The following describes the some options for the restore command:
• t – Lists the table of contents of the backup media.
• r – Restores the entire file system from the backup media.
• x – Restores only the files named on the command line.
• i – Invokes an interactive restore.
• v – Specifies Verbose mode. Displays pathnames to the terminal
screen as each file is being restored.
• f – Specifies the tape device name.
38
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Restoring Regular File Systems
To restore a regular file system, (for example, /home, or /opt) back to
disk.
Example
# mkfs /dev/sda#
# mount /dev/sda# /mnt
# cd /mnt
# restore -rf /dev/rmt/#
# rm restoresymtable
# cd /
# umount /mnt
# fsck /dev/sda#
# dump -0uf /dev/rmt/# /dev/sda#
# mount /dev/sda# /home
39
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Command: at
at -f script [m] <arg_hour> [<arg_date>] [+arg_increment>]
 Executes a command file at a given date
<arg_temps> : hh:mm | now | noon | midnight
<arg_date> : <month> <day> or today | tomorrow
<arg_increment> : <number> minutes | hours | days | weeks | months
$ at -f myscript.sh 17:30 mar 22 2014 +2 hours
job 24 at 2014-03-22 19:30
at –l / atq : list the number of registered commands
at -d / atrm : cancels a registered command
Authorized users (respectively non-authorized users ) to use
this command are declared in a system file at.allow
(respectively at.deny).
40
N T I
Prepared by: Eng. Anwar Fouad
Disk Quota
41
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Configuring the Quota System
● Overview
 Implemented within the kernel
 Enabled on a per-filesystem basis
 Individual policies for groups or users
■ Limit by the number of blocks or inodes
■ Implement both soft and hard limits
● Initialization
 Partition mount options: usrquota, grpquota
 Initialize database: quotacheck
 Create these files
#touch aquota.group
#touch aquota.user
42
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Setting Quotas for Users
● Implementation
 Start or stop quotas: quotaon, quotaoff
 Edit quotas directly: edquota username
 From a shell:
 setquota username 4096 5120 40 50 /Data
 Define prototypical users:
 edquota -p user1 user2
43
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Reporting Quota Status
● Reporting
 User inspection: quota
 Quota overviews: repquota
N T I
Linux Fundamentals
Network File Sharing Services
45
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
File Transfer Protocol(FTP)
● vsftpd - the default Red Hat Enterprise Linux ftp server
● No longer managed by xinetd
● Allows system, anonymous or virtual (FTPonly)user access
● The anonymous directory hierarchy is provided by the
vsftpd RPM
● /etc/vsftpd/vsftpd.conf is the main configuration file
46
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Service Profile: FTP
● Type: SystemV-managed service
● Package: vsftpd
● Daemon: /usr/sbin/vsftpd
● Script: /etc/init.d/vsftpd
● Ports: 21 (ftp), 20 (ftp-data)
● Configuration: /etc/vsftpd/vsftpd.conf /etc/vsftpd/ftpusers
/etc/vsftpd/user_list /etc/pam.d/vsftpd
● Log: /var/log/xferlog
47
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Network File Service (NFS)
● The Red Hat Enterprise Linux NFS service is similar to
other BSD and UNIX variants
 Exports are listed in /etc/exports
 Server notified of changes to exports list with
exportfs -r or service nfs restart
 Shared directories are accessed through the mount command
48
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
Service Profile: NFS
● Type: System V-managed service
● Package: nfs-utils
● Daemons: rpc.nfsd, rpc.lockd, rpciod, rpc.
mountd, rpc.rquotad, rpc.statd
● Scripts: /etc/init.d/nfs, /etc/init.d/nfslock
● Ports: 2049(nfsd), Others assigned by portmap (111)
● Configuration: /etc/sysconfig/nfs , /etc/exports ,
/var/lib/nfs/rmtab
49
N T I
Prepared by: Eng. Anwar Fouad
Prepared by: Eng. Anwar Fouad
NFS Server
● Exported directories are defined in /etc/exports
NFS utilities
● exportfs –v from server-side
● showmount -e hostname from client-side

More Related Content

Similar to Linux Fundamentals - Extra.pdf

Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveAlison Chaiken
 
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsLinux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsKenny (netman)
 
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Valeriy Kravchuk
 
Crikeycon 2019 Velociraptor Workshop
Crikeycon 2019 Velociraptor WorkshopCrikeycon 2019 Velociraptor Workshop
Crikeycon 2019 Velociraptor WorkshopVelocidex Enterprises
 
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling ToolsTIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling ToolsXiaozhe Wang
 
A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment Systema3sec
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetPuppet
 
Introduction to containers
Introduction to containersIntroduction to containers
Introduction to containersNitish Jadia
 
Terraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCPTerraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCPSamuel Chow
 
Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势Anthony Wong
 
Thinking DevOps in the Era of the Cloud - Demi Ben-Ari
Thinking DevOps in the Era of the Cloud - Demi Ben-AriThinking DevOps in the Era of the Cloud - Demi Ben-Ari
Thinking DevOps in the Era of the Cloud - Demi Ben-AriDemi Ben-Ari
 
Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Amin Astaneh
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftYaniv cohen
 

Similar to Linux Fundamentals - Extra.pdf (20)

Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to love
 
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsLinux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fs
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
Dynamic tracing of MariaDB on Linux - problems and solutions (MariaDB Server ...
 
Chap 17 advfs
Chap 17 advfsChap 17 advfs
Chap 17 advfs
 
Crikeycon 2019 Velociraptor Workshop
Crikeycon 2019 Velociraptor WorkshopCrikeycon 2019 Velociraptor Workshop
Crikeycon 2019 Velociraptor Workshop
 
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling ToolsTIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
TIP1 - Overview of C/C++ Debugging/Tracing/Profiling Tools
 
A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment System
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from Puppet
 
Introduction to containers
Introduction to containersIntroduction to containers
Introduction to containers
 
When ACLs Attack
When ACLs AttackWhen ACLs Attack
When ACLs Attack
 
Linux Security
Linux SecurityLinux Security
Linux Security
 
Terraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCPTerraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCP
 
Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势
 
Thinking DevOps in the Era of the Cloud - Demi Ben-Ari
Thinking DevOps in the Era of the Cloud - Demi Ben-AriThinking DevOps in the Era of the Cloud - Demi Ben-Ari
Thinking DevOps in the Era of the Cloud - Demi Ben-Ari
 
Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)
 
Aide
AideAide
Aide
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 

Recently uploaded

Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 

Recently uploaded (20)

Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 

Linux Fundamentals - Extra.pdf

  • 1. 0 N T I Prepared by: Eng. Anwar Fouad Linux Fundamentals
  • 2. 1 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad What is Linux? A fully-networked 32/64-Bit Unix-like Operating System  Unix Tools Like sed, awk , find, and grep (explained later)  Compilers Like C, C++, Fortran, …etc.  Network Tools Like telnet, ftp, ping, traceroute Multi-user, Multitasking, Multiprocessor Has the X Windows GUI Coexists with other Operating Systems Runs on multiple hardware platforms Includes the Source Code
  • 3. 2 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad How do you get it? Download it from the Internet From a “Distribution” (e.g. Red Hat)  Linux kernel  X Windows system and GUI  Web, e-mail, FTP servers  Installation & configuration support  3rd party apps  Hardware support
  • 4. 3 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Popular Linux Distributions
  • 5. 4 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Why is it significant? Growing popularity Powerful  Runs on multiple hardware platforms  Users like its speed and stability  No requirement for latest hardware It’s “free”  Licensed under GPL  Vendors are distributors who package Linux
  • 6. 5 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Linux’s place in the market Impacts:  Applications:  Web servers (65%)  Web Infrastructure (mail, DNS) (15%)  File/Print (15%)  DB & DB Applications (2%)  Observations  Linux/Apache share of Web serving high  Many SMB and small ISP  Strong mindshare among developers
  • 7. N T I Linux Fundamentals Using the system
  • 8. N T I Linux Fundamentals Linux Command Basics Working with files and directories
  • 9. 8 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Syntax Of Basic Commands <command name> [<options>] [<arg1> <arg2> ... <arg n>] Expressions between brackets [ ] are optional. <options>: sequence of letters preceded by ‘-’ character. each letter represents one option. the order of the options has no importance. <arg i>: string of characters its meaning depends on the current command (usually, they are file pathnames) <command name>: command name usually an executable filename. Different command elements are delimited by at least one space character. Linux/Unix is case-sensitive.
  • 10. 9 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Execute a command line To execute a command, type its name and arguments at the command line ls -l /etc Command name Options (flags) Arguments
  • 11. 10 N T I Prepared by: Eng. Anwar Fouad File System Finding
  • 12. 11 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Finding and Processing Files ● Use locate ● Use find
  • 13. 12 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad locate ● Queries a pre-built database of paths to files on the system  Database must be updated by administrator  Full path is searched, not just filename ● May only search directories where the user has read and execute permission
  • 14. 13 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad locate Examples ● locate file1  Search for files with “file1" in the name or path ● Useful options  -i performs a case-insensitive search  -n X lists only the first X matches
  • 15. 14 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad find ● find [directory...] [criteria...] ● Searches directory trees in real-time  Slower but more accurate than locate  CWD is used if no starting directory given  All files are matched if no criteria given ● May only search directories where the user has read and execute permission
  • 16. 15 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Basic find Examples ● find -name snow.png  Search for files named snow.png ● find -iname snow.png  Case-insensitive search for files named snow.png,Snow.png, SNOW.PNG, etc ● find -user joe -group joe  Search for files owned by the user joe and the group joe
  • 17. 16 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad find and Logical Operators ● Criteria are ANDed together by default. ● Can be OR'd or negated with -o and -not ● Parentheses can be used to determine logic order, but must be escaped in bash.  find -user joe -not -group joe  find -user joe -o -user jane  find -not ( -user joe -o -user jane )
  • 18. 17 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad find and Numeric Criteria ● Many find criteria take numeric values ● find -size 1024k  Files with a size of exactly 1 megabyte ● find -size +1024k  Files with a size over 1 megabyte ● find -size -1024k  Files with a size less than 1 megabyte
  • 19. 18 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad find and Access Times ● find can match by inode timestamps  -atime when file was last read  -mtime when file data last changed  -ctime when file data or metadata last changed ● Value given is in days  find -ctime -10 Files modified less than 10 days ago ● Value given is in minutes  find -cmin -60 Files modified less than 1 hour ago
  • 20. 19 N T I Prepared by: Eng. Anwar Fouad Storage Management
  • 21. 20 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad What is Software RAID? ● Multiple disks grouped together into "arrays” to provide better performance, redundancy or both. ● mdadm - provides the administration interface to software RAID. ● Many "RAID Levels" supported, including RAID O, 1 and 5. ● Spare disks add extra redundancy ● RAID devices are named, /dev/md0, /dev/md1, /dev/md2, /dev/md3 and so on.
  • 22. 21 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Software RAID Configuration ● Create and define RAID devices using mdadm mdadm -C /dev/md0 -l 1 -n 2 -x 1 /dev/sda1 /dev/sdb1 /dev/sdc1 ● Format each RAID device with a filesystem mke2fs -j /dev/md0 ● Test the RAID devices ● mdadm allows you to check the status of your RAID devices mdadm --detail /dev/md0
  • 23. 22 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Software RAID Testing and Recovery ● Simulating disk failures mdadm /dev/md0 -f /dev/sda1 ● Recovering from a software RAID disk failure  replace the failed hard drive and power on  reconstruct partitions on the replacement drive  mdadm /dev/md0 -a /dev/sda1 ● mdadm, /proc/mdstat, and syslog messages
  • 24. 23 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad What is Logical Volume Manager (LVM)? ● A layer of abstraction that allows easy manipulation of volumes. Including resizing of filesystems ● Allows reorganization of filesystems across multiple physical devices
  • 25. 24 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad LVM
  • 26. 25 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Creating Logical Volumes ● Create physical volumes pvcreate /dev/hda3 ● Assign physical volumes to volume groups vgcreate vg0 /dev/hda3 ● Create logical volumes from volume groups lvcreate -L 256M -n data vg0 mke2fs -j /dev/vg0/data
  • 27. 26 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Resizing Logical Volumes Growing Volumes  lvextend can grow logical volumes  vgextend adds new physical volumes to an existing volume group. ● Shrinking volumes  lvreduce can then reduce the volume.  Volume Groups can be reduced with: pvmove /dev/hda3 vgreduce vg0 /dev/hda3
  • 28. 27 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Logical Volume Manager Snapshots ● Snapshots are special Logical Volumes that are an exact copy of an existing Logical Volume at the time the snapshot is created ● Snapshots are perfect for backups and other operations where a temporary copy of an existing dataset is needed ● Snapshots only consume space where they are different from the original Logical Volume
  • 29. 28 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Using LVM Snapshots ● Create Snapshot of existing Logical Volume # lvcreate -l 64 -s -n databackup /dev/vg0/data ● Mount Snapshot # mkdir -p /mnt/databackup # mount -o ro /dev/vg0/databackup /mnt/databackup ● Remove Snapshot # umount /mnt/databackup # lvremove /dev/vg0/databackup
  • 30. N T I Linux Fundamentals Backup and restore
  • 31. 30 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Importance of Regular File System Backups Backing up file systems is one of the most crucial system administration functions. Backups should be performed on a regularly scheduled basis to prevent loss of data due to: • Accidental deletion of files • Hardware failures • Problems when reinstalling or upgrading a system • System crashes • System break-in by an unauthorized user compromising data integrity • Natural disasters
  • 32. 31 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Overview of Backup Methods  The backup process involves copying data from one computer to some other reliable storage medium for safekeeping.  Once the data has been archived, the system administrator can then restore data to the system from any previously recorded backup.  Considerations that are relevant for storage devices:  Cost  Size  Manageability  Reliability
  • 33. 32 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Overview of Backup Methods There are many types of backup procedures that define how the backup will take place:  Full - will backup everything on the hard drive at the scheduled point in the day  Partial - backs up selected files  Incremental - only the files that have changed since the last backup
  • 34. 33 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Archiving Tools: tar ● tar can backup to a file or tape device ● supports GZIP and BZIP2 compression ● can preserve file permissions, ownership and timestamps ● supports extended attributes ● uses rmt to write to a remote tape device
  • 35. 34 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Archiving Tools: dump/restore ● Back up and restore ext2/3/4 filesystems  Does not work with other filesystems  dump should only be used on unmounted filesystems or filesystems that are read-only. ● Can do full or incremental backups ● Examples: dump -0uf /dev/nst0 /dev/hda2 restore -rf /dev/nst0
  • 36. 35 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad The /etc/dumpdates File Each line in /etc/dumpdates file shows the file system backed up, the level of the last backup, and the day, date, and time of the backup. The following is an example of a typical /etc/dumpdates file: # cat /etc/dumpdates /dev/sda3 0 Fri Jun 2 19:12:27 2000 /dev/sda1 0 Fri Jun 2 20:44:02 2000 /dev/sda3 5 Thu Jun 8 19:42:21 2000
  • 37. 36 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Backing Up to Tape 1. Become root to bring the system to single-user mode and unmount the file systems. # shutdown -v -g30 “System is being shutdown for backup” Shutdown started. Mon Jun 5 14:05:46 MdT 2000 Broadcast Message from root (pts/1) on host1 Mon Jun 5 14:05:46... The system host1 will be shut down in 30 minutes System is being shutdown for backup 2. Unmount all file systems (except / and /usr) # umount /home 3. Check the integrity of the file system data with the fsck command, but only if the file system has been unmounted. # fsck /home 4. Perform a full level 0 backup of the /home file system. # dump -0uf /dev/rmt/0 /home DUMP: Writing 32 Kilobyte records DUMP: Date of this level 0 dump: Mon Jun 5 2000 14:10:15 PM MDT DUMP: Date of last level 0 dump: the epoch DUMP: Dumping / dev/sda3 (host1:/home) to /dev/rmt/0. …. DUMP: DUMP IS DONE DUMP: Level 0 dump on Mon Jun 5 2000 14:10:15 PM MDT #
  • 38. 37 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Restoring File Systems Command Format restore options [ arguments ] [ filesystem ] restore options [ arguments ] [ filenames . . . ] Common Options The following describes the some options for the restore command: • t – Lists the table of contents of the backup media. • r – Restores the entire file system from the backup media. • x – Restores only the files named on the command line. • i – Invokes an interactive restore. • v – Specifies Verbose mode. Displays pathnames to the terminal screen as each file is being restored. • f – Specifies the tape device name.
  • 39. 38 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Restoring Regular File Systems To restore a regular file system, (for example, /home, or /opt) back to disk. Example # mkfs /dev/sda# # mount /dev/sda# /mnt # cd /mnt # restore -rf /dev/rmt/# # rm restoresymtable # cd / # umount /mnt # fsck /dev/sda# # dump -0uf /dev/rmt/# /dev/sda# # mount /dev/sda# /home
  • 40. 39 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Command: at at -f script [m] <arg_hour> [<arg_date>] [+arg_increment>]  Executes a command file at a given date <arg_temps> : hh:mm | now | noon | midnight <arg_date> : <month> <day> or today | tomorrow <arg_increment> : <number> minutes | hours | days | weeks | months $ at -f myscript.sh 17:30 mar 22 2014 +2 hours job 24 at 2014-03-22 19:30 at –l / atq : list the number of registered commands at -d / atrm : cancels a registered command Authorized users (respectively non-authorized users ) to use this command are declared in a system file at.allow (respectively at.deny).
  • 41. 40 N T I Prepared by: Eng. Anwar Fouad Disk Quota
  • 42. 41 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Configuring the Quota System ● Overview  Implemented within the kernel  Enabled on a per-filesystem basis  Individual policies for groups or users ■ Limit by the number of blocks or inodes ■ Implement both soft and hard limits ● Initialization  Partition mount options: usrquota, grpquota  Initialize database: quotacheck  Create these files #touch aquota.group #touch aquota.user
  • 43. 42 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Setting Quotas for Users ● Implementation  Start or stop quotas: quotaon, quotaoff  Edit quotas directly: edquota username  From a shell:  setquota username 4096 5120 40 50 /Data  Define prototypical users:  edquota -p user1 user2
  • 44. 43 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Reporting Quota Status ● Reporting  User inspection: quota  Quota overviews: repquota
  • 45. N T I Linux Fundamentals Network File Sharing Services
  • 46. 45 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad File Transfer Protocol(FTP) ● vsftpd - the default Red Hat Enterprise Linux ftp server ● No longer managed by xinetd ● Allows system, anonymous or virtual (FTPonly)user access ● The anonymous directory hierarchy is provided by the vsftpd RPM ● /etc/vsftpd/vsftpd.conf is the main configuration file
  • 47. 46 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Service Profile: FTP ● Type: SystemV-managed service ● Package: vsftpd ● Daemon: /usr/sbin/vsftpd ● Script: /etc/init.d/vsftpd ● Ports: 21 (ftp), 20 (ftp-data) ● Configuration: /etc/vsftpd/vsftpd.conf /etc/vsftpd/ftpusers /etc/vsftpd/user_list /etc/pam.d/vsftpd ● Log: /var/log/xferlog
  • 48. 47 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Network File Service (NFS) ● The Red Hat Enterprise Linux NFS service is similar to other BSD and UNIX variants  Exports are listed in /etc/exports  Server notified of changes to exports list with exportfs -r or service nfs restart  Shared directories are accessed through the mount command
  • 49. 48 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad Service Profile: NFS ● Type: System V-managed service ● Package: nfs-utils ● Daemons: rpc.nfsd, rpc.lockd, rpciod, rpc. mountd, rpc.rquotad, rpc.statd ● Scripts: /etc/init.d/nfs, /etc/init.d/nfslock ● Ports: 2049(nfsd), Others assigned by portmap (111) ● Configuration: /etc/sysconfig/nfs , /etc/exports , /var/lib/nfs/rmtab
  • 50. 49 N T I Prepared by: Eng. Anwar Fouad Prepared by: Eng. Anwar Fouad NFS Server ● Exported directories are defined in /etc/exports NFS utilities ● exportfs –v from server-side ● showmount -e hostname from client-side