PowerPoint Slides

Download Report

Transcript PowerPoint Slides

UNIX
File
Hierarchy
CIS 191 – Lesson 3
/
/bin
/boot
/dev
/etc
/home
/lib
/lost+found
/mnt
/opt
/proc
/root
/sbin
/tmp
/usr
The UNIX/Linux
File System Hierarchy
Basic File Hierarchy Standard Directories
CIS 191 – Lesson 1
Directory
Contents
/
the root directory, the top-level directory in the FHS
/bin
/boot
binary files forming the commands and shells used by the system
administrator and users
files used during the initial boot-up process including the kernel
/dev
device files for connected hardware
/etc
system configuration files
/home
individual home directories owned by each user
/lib
/lost+found
shared libraries needed to boot the system and run the commands in the root
filesystem (i.e. commands in /bin and /sbin)
recovered files that were corrupted by power failures or system crashes
/mnt
mount points for floppies, cds, or other file systems
/opt
add-on software packages and/or commercial applications
/proc
kernel level process information
/root
home directory for the root user
/sbin
system administration commands reserved for the superuser (root)
/tmp
temporary files that are deleted when the system is rebooted or started
/usr
program files and related files for use by all users
/var
variable data such as log files, print spool files, and mail queues
Example GNU/Linux Directory Structure
/
/home
/etc
fstab
resolv.conf
group
securetty
hosts
shadow
hosts.allow
sysctl.conf
hosts.deny
sysconfig/
httpd/
network
conf/
network-scripts/
httpd.conf
ifcfg-eth0
[root@tomcat
~]#
inittab
xinetd.d/
bin telnetdev home
issue
modules.confboot
etc lib
motd
[root@tomcat ~]#
mtab
pam.d/
login
passwd
profile
rc.d/
rc
rc0.d/
rc1.d/
rc2.d/
rc3.d/
rc4.d/
rc5.d/
rc6.d/
rc.sysinit
/bin
/sbin
bash
arp
cat
bastille
chgrp
chkconfig
chmod
debugfs
chown
dhclient
cp
dmesg
cpio
dump
date
e2label
ls /
dd
fdisk
dflost+foundgrubmisc
dmesg
halt mnt
media
echo
ifconfig
env
init
grep
insmod
hostname
iptables
ln
lsmod
ls
lspci
mail
mingetty
mkdir
mkfs
more
partprobe
mount
portmap
mv
quotaon
netstat
quotaoff
ping
restore
ps
rmmod
rm
route
rmdir
service
rpm
shutdown
sleep
tripwire
sort
tune2fs
su
tar
touch
umount
uname
vi
/usr
bin/
net
opt
/var
sbin/
crond
cupsd
httpd
kudzu
pppd
sendmail
sshd
traceroute
sbin
useradd
usermod
selinux
userdel
xinetd
X11R6/
bin/
startx
twm
X
xclock
xinit
xsetroot
xwd
at
bc
cal
cancel
clear
crontab
fdformat
file
proc
find
finger
root
gcc
head
id
info
less
lp/lpr
lpstat
make
man
mesg
mozilla
openssl
passwd
perl
quota
scp
spell
ssh
sudo
tail
hda
tee
hda1
telnet
had2
wc
tty1
who
write
xxd
rsimms/
.bash_profile
.bashrc
log/
Bastille/
Assessment/
assessment-report.html
dmesg
httpd/
access_log
error_log
spool/
srv
tmp var
clientmqueue
sys
/root
.bash_profile
.bashrc
/mnt
cdrom/
floppy/
usr
/opt
lampp/
bin
mysql
htdocs
phpmyadmin/
index.php
sbin/
mysqld
/tmp
ssh-XXjXuIH9/
agent.13695
/dev /boot
/lib
grub/
modules/
grub.conf
2.4.20-6/
initrd-2.4.20-6.img
kernel/
vmlinuz-2.4.20-6
drivers/
net/
3c59x.o
/proc
interupts
ioports
modules
sys/
net/
ipv4/
ip_forward
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
Example GNU/Linux Directory Structure
CIS 90 files, directories, commands
/
/home
/etc
fstab
group
hosts
hosts.allow
hosts.deny
httpd/
conf/
httpd.conf
inittab
issue
modules.conf
motd
mtab
pam.d/
login
passwd
profile
rc.d/
rc
rc0.d/
rc1.d/
rc2.d/
rc3.d/
rc4.d/
rc5.d/
rc6.d/
rc.sysinit
resolv.conf
securetty
shadow
sysctl.conf
sysconfig/
network
network-scripts/
ifcfg-eth0
xinetd.d/
telnet
/bin
/sbin
bash
cat
chgrp
chmod
chown
cp
cpio
date
dd
df
dmesg
echo
env
grep
hostname
ln
ls
mail
mkdir
more
mount
mv
netstat
ping
ps
rm
rmdir
rpm
sleep
sort
su
tar
touch
umount
uname
vi
arp
bastille
chkconfig
debugfs
dhclient
dmesg
dump
e2label
fdisk
grub
halt
ifconfig
init
insmod
iptables
lsmod
lspci
mingetty
mkfs
partprobe
portmap
quotaon
quotaoff
restore
rmmod
route
service
shutdown
tripwire
tune2fs
/usr
bin/
at
bc
cal
cancel
clear
crontab
fdformat
file
find
finger
gcc
head
id
info
less
lp/lpr
lpstat
make
man
mesg
mozilla
openssl
passwd
perl
quota
scp
spell
ssh
sudo
tail
tee
telnet
wc
who
write
xxd
rsimms/
.bash_profile
.bashrc
/var
sbin/
crond
cupsd
httpd
kudzu
pppd
sendmail
sshd
traceroute
useradd
usermod
userdel
xinetd
X11R6/
bin/
startx
twm
X
xclock
xinit
xsetroot
xwd
log/
Bastille/
Assessment/
assessment-report.html
dmesg
httpd/
access_log
error_log
spool/
clientmqueue
/root
.bash_profile
.bashrc
/mnt
cdrom/
floppy/
/opt
lampp/
bin
mysql
htdocs
phpmyadmin/
index.php
sbin/
mysqld
/tmp
ssh-XXjXuIH9/
agent.13695
/dev /boot
hda
hda1
had2
tty1
/lib
grub/
modules/
grub.conf
2.4.20-6/
initrd-2.4.20-6.img
kernel/
vmlinuz-2.4.20-6
drivers/
net/
3c59x.o
/proc
interupts
ioports
modules
sys/
net/
ipv4/
ip_forward
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
Example GNU/Linux Directory Structure
CIS 191 files, directories, commands
/
/home
/etc
fstab
group
hosts
hosts.allow
hosts.deny
httpd/
conf/
httpd.conf
inittab
issue
modules.conf
motd
mtab
pam.d/
login
passwd
profile
rc.d/
rc
rc0.d/
rc1.d/
rc2.d/
rc3.d/
rc4.d/
rc5.d/
rc6.d/
rc.sysinit
resolv.conf
securetty
shadow
sysctl.conf
sysconfig/
network
network-scripts/
ifcfg-eth0
xinetd.d/
telnet
/bin
/sbin
bash
cat
chgrp
chmod
chown
cp
cpio
date
dd
df
dmesg
echo
env
grep
hostname
ln
ls
mail
mkdir
more
mount
mv
netstat
ping
ps
rm
rmdir
rpm
sleep
sort
su
tar
touch
umount
uname
vi
arp
bastille
chkconfig
debugfs
dhclient
dmesg
dump
e2label
fdisk
grub
halt
ifconfig
init
insmod
iptables
lsmod
lspci
mingetty
mkfs
partprobe
portmap
quotaon
quotaoff
restore
rmmod
route
service
shutdown
tripwire
tune2fs
/usr
bin/
at
bc
cal
cancel
clear
crontab
fdformat
file
find
finger
gcc
head
id
info
less
lp/lpr
lpstat
make
man
mesg
mozilla
openssl
passwd
perl
quota
scp
spell
ssh
sudo
tail
tee
telnet
wc
who
write
xxd
rsimms/
.bash_profile
.bashrc
/var
sbin/
crond
cupsd
httpd
kudzu
pppd
sendmail
sshd
traceroute
useradd
usermod
userdel
xinetd
X11R6/
bin/
startx
twm
X
xclock
xinit
xsetroot
xwd
log/
Bastille/
Assessment/
assessment-report.html
dmesg
httpd/
access_log
error_log
spool/
clientmqueue
/root
.bash_profile
.bashrc
/mnt
cdrom/
floppy/
/opt
lampp/
bin
mysql
htdocs
phpmyadmin/
index.php
sbin/
mysqld
/tmp
ssh-XXjXuIH9/
agent.13695
/dev /boot
hda
hda1
had2
tty1
/lib
grub/
modules/
grub.conf
2.4.20-6/
initrd-2.4.20-6.img
kernel/
vmlinuz-2.4.20-6
drivers/
net/
3c59x.o
/proc
interupts
ioports
modules
sys/
net/
ipv4/
ip_forward
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
Example GNU/Linux Directory Structure
CIS 192 files, directories, commands
/
/home
/etc
fstab
group
hosts
hosts.allow
hosts.deny
httpd/
conf/
httpd.conf
inittab
issue
modules.conf
motd
mtab
pam.d/
login
passwd
profile
rc.d/
rc
rc0.d/
rc1.d/
rc2.d/
rc3.d/
rc4.d/
rc5.d/
rc6.d/
rc.sysinit
resolv.conf
securetty
shadow
sysctl.conf
sysconfig/
network
network-scripts/
ifcfg-eth0
xinetd.d/
telnet
/bin
/sbin
bash
cat
chgrp
chmod
chown
cp
cpio
date
dd
df
dmesg
echo
env
grep
hostname
ln
ls
mail
mkdir
more
mount
mv
netstat
ping
ps
rm
rmdir
rpm
sleep
sort
su
tar
touch
umount
uname
vi
arp
bastille
chkconfig
debugfs
dhclient
dmesg
dump
e2label
fdisk
grub
halt
ifconfig
init
insmod
iptables
lsmod
lspci
mingetty
mkfs
partprobe
portmap
quotaon
quotaoff
restore
rmmod
route
service
shutdown
tripwire
tune2fs
/usr
bin/
at
bc
cal
cancel
clear
crontab
fdformat
file
find
finger
gcc
head
id
info
less
lp/lpr
lpstat
make
man
mesg
mozilla
openssl
passwd
perl
quota
scp
spell
ssh
sudo
tail
tee
telnet
wc
who
write
xxd
rsimms/
.bash_profile
.bashrc
/var
sbin/
crond
cupsd
httpd
kudzu
pppd
sendmail
sshd
traceroute
useradd
usermod
userdel
xinetd
X11R6/
bin/
startx
twm
X
xclock
xinit
xsetroot
xwd
log/
Bastille/
Assessment/
assessment-report.html
dmesg
httpd/
access_log
error_log
spool/
clientmqueue
/root
.bash_profile
.bashrc
/mnt
cdrom/
floppy/
/opt
lampp/
bin
mysql
htdocs
phpmyadmin/
index.php
sbin/
mysqld
/tmp
ssh-XXjXuIH9/
agent.13695
/dev /boot
hda
hda1
had2
tty1
/lib
grub/
modules/
grub.conf
2.4.20-6/
initrd-2.4.20-6.img
kernel/
vmlinuz-2.4.20-6
drivers/
net/
3c59x.o
/proc
interupts
ioports
modules
sys/
net/
ipv4/
ip_forward
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
Example GNU/Linux Directory Structure
/
(showing just a few of the many files)
/home
/etc
fstab
group
hosts
hosts.allow
hosts.deny
httpd/
conf/
httpd.conf
inittab
issue
modules.conf
motd
mtab
pam.d/
login
passwd
profile
rc.d/
rc
rc0.d/
rc1.d/
rc2.d/
rc3.d/
rc4.d/
rc5.d/
rc6.d/
rc.sysinit
resolv.conf
securetty
shadow
sysctl.conf
sysconfig/
network
network-scripts/
ifcfg-eth0
xinetd.d/
telnet
/bin
/sbin
bash
cat
chgrp
chmod
chown
cp
cpio
date
dd
df
dmesg
echo
env
grep
hostname
ln
ls
mail
mkdir
more
mount
mv
netstat
ping
ps
rm
rmdir
rpm
sleep
sort
su
tar
touch
umount
uname
vi
arp
bastille
chkconfig
debugfs
dhclient
dmesg
dump
e2label
fdisk
grub
halt
ifconfig
init
insmod
iptables
lsmod
lspci
mingetty
mkfs
partprobe
portmap
quotaon
quotaoff
restore
rmmod
route
service
shutdown
tripwire
tune2fs
/usr
bin/
at
bc
cal
cancel
clear
crontab
fdformat
file
find
finger
gcc
head
id
info
less
lp/lpr
lpstat
make
man
mesg
mozilla
openssl
passwd
perl
quota
scp
spell
ssh
sudo
tail
tee
telnet
wc
who
write
xxd
rsimms/
.bash_profile
.bashrc
/var
sbin/
crond
cupsd
httpd
kudzu
pppd
sendmail
sshd
traceroute
useradd
usermod
userdel
xinetd
X11R6/
bin/
startx
twm
X
xclock
xinit
xsetroot
xwd
log/
Bastille/
Assessment/
assessment-report.html
dmesg
httpd/
access_log
error_log
spool/
clientmqueue
/root
.bash_profile
.bashrc
/mnt
cdrom/
floppy/
/opt
lampp/
bin
mysql
htdocs
phpmyadmin/
index.php
sbin/
mysqld
/tmp
ssh-XXjXuIH9/
agent.13695
/dev /boot
hda
hda1
had2
tty1
/lib
grub/
modules/
grub.conf
2.4.20-6/
initrd-2.4.20-6.img
kernel/
vmlinuz-2.4.20-6
drivers/
net/
3c59x.o
/proc
interupts
ioports
modules
sys/
net/
ipv4/
ip_forward
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
File
Types
CIS 191 – Lesson 3
File Types and Commands
Long listing
code
(ls –l)
Type
How to
make
one
d
directory
mkdir
-
regular
touch
l
symbolic link
ln -s
c
special (character device files)
mknod
b
special (block device files, buffered)
mknod
Note: Other files types includes sockets (s)
and named pipes (p)
CIS 191 – Lesson 3
Various Types of Files (found in /etc)
Regular files (black)
Directories (blue)
Regular files with
execute bit set
(green)
CIS 191 – Lesson 3
Various Types of Files (found in /bin)
Long listing of files with
names starting with s or z
Symbolic links
(light blue) with
arrow to real file
Regular file with setuid
bit (red background)
Rest are regular files with
execute bit set (green)
Use file command to show
additional file type information
CIS 191 – Lesson 3
Various Types of Files (found in /dev)
Block
Character
Special files
(yellow with
black
background)
CIS 191 – Lesson 3
/boot (Ubuntu 8.04 Desktop)
The kernel
(compressed)
Kernel version
number
Kernel major revision
number. Prior to
version 2.6, stable
releases were even
and developmental
versions odd
Kernel patch
number
Kernel minor
revision
number
CIS 191 – Lesson 3
/boot (Red Hat 9)
The kernel
The kernel
(compressed)
Symbolic link
to kernel
System Installation
• Prepare the Disk
• Select the software
• Install the Boot Loader
Preparing the Disk
• Partitioning
– fdisk
(command line)
– Disk Druid (curses and graphical)
• Formatting
– mkfs
(command line)
• Assigning Mount Points
– /etc/fstab (text file)
Partitioning Schemes
1.
2.
3.
4.
5.
One primary partition: / (root)
Two partitions: / and swap
Three partitions: boot, /, and swap
Three partitions: /, swap, and home
N partitions: /, swap, home, usr, var, tmp, and
boot.
Types of Filesystems
• EXT – Extended File System
– ext2, ext3, ext4
•
•
•
•
•
•
Reiser – R.I.P.
JFS – from IBM
XFS – from SGI
FAT
NTFS
ISO9660
Mounting File Systems
/
boot
bin
etc
dev
/dev/sda2
home
/dev/sda1
/dev/sda5
lib
tmp
usr
var
CIS 191 - Lesson 3
New
Commands
and files
CIS 191 - Lesson 3
New commands:
df
dpkg
dmesg
du
fdisk
free
hostname
ifconfig
init
lspci
man
mount
su
sudo
uname
-
New Files and Directories:
/etc/password
/etc/mtab
/proc/cpuinfo
- user accounts
- current mount points
- kernel cpu info
Show free disk space
Show packages (Debian)
Show kernel boot messages
Show disk usage
Partition utility
show memory
Show hostname
Show NIC configuration
Change runlevels
Show PCI devices
Show manual page documentation
Show mount points
Switch user
Do command as root
show OS info
UNIX top level tree directories:
/bin, /boot, /dev, /etc, /home, /lib, /proc, /root, /sbin, /tmp, /usr, /var