View
220
Download
0
Category
Preview:
Citation preview
Linux Overview
Why Linux ?
• Not-so-ancient history – Torvalds, Linus Torvalds, 002
• the Helsinki University, as a student, low budget, work home
– rapid and enthusiastic growth from toy to tool – ported to almost anything – from text mode servers to GUI desktops
Linux Overview
Why Linux - continued
• A few good reasons – comes with its own sources: high degree of customization possible, most portable OS – stable server platform – wide range of support, from distributors and the community– leave the licensing adventure to the stronger-hearted
Linux Overview
The Linux distribution (focus on Red Hat)
• Basic OS components of a UNIX system– the kernel – the heart of the OS – system programs – implement the various services required from an operating system – application programs – get useful things done
Linux Overview
• The bootloader – Choice of alternative OS – Sends boot parameters to the kernel – GRUB vs LILO
• User accounts, groups – Root account - no questions asked - careful
The Linux distribution (focus on Red Hat)
Linux Overview
• The filesystem (common)– Root directory: files that are necessary for booting the system – /root: The home directory for user root. This is usually not accessible to other users on
the system – /usr: commands, libraries, manual pages, and user utilities – /var: files that change: spool directories, logs– /bin, /sbin: system programs – /home: users accounts home directories – /etc: system configuration files – /proc: system info – /dev: special device files for all the devices – /mnt: predefined mount point for devices
The Linux distribution (focus on Red Hat)
Linux Overview
• The package manager – What it does (as opposed to “make install”) – How it works, dependencies:
• install
• erase
• upgrade
• queries: finding installed packages, installed files
– Rebuilding packages• spec files
The Linux distribution (focus on Red Hat)
Linux Overview
[root@bummer download]# netstat -atunProto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTENtcp 0 0 127.0.0.1:631 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:7741 0.0.0.0:* LISTENtcp 0 0 192.168.1.64:52479 83.140.65.8:80 ESTABLISHEDtcp 0 0 192.168.1.64:50956 83.140.65.8:80 ESTABLISHEDtcp 0 0 192.168.1.64:48980 83.140.65.8:80 ESTABLISHEDtcp 0 0 192.168.1.64:39254 192.168.1.199:993 ESTABLISHEDtcp 0 0 192.168.1.64:53081 216.155.193.157:5050 ESTABLISHEDtcp 0 0 192.168.1.64:49203 217.74.209.135:5223 ESTABLISHEDtcp 0 0 192.168.1.64:40836 192.168.1.63:3389 ESTABLISHED
Practical aspects - view open ports and check connections
Linux Overview
• firewalls filter open ports; scan from another machinePractical aspects - view open ports - continued
Linux Overview
• ntsysv lets you select system services to be started at boot time (for the current runlevel)
• chkconfig –list (all runlevels)
Practical aspects – startup services
Linux Overview
# less /etc/xinetd.d/ftpservice ftp
{
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/ftpd
disable = no
only-from = 192.168.200.3 192.168.200.7 192.168.200.9
only-from += 192.168.200.10 192.168.200.12 172.16.0.0
no_access = 172.16.{1,2,3,10}
access_times = 07:00-21:00
}
Practical aspects – startup services (continued) – on demand services
Linux Overview
Practical aspects – check your system
• find files modified within the last 24 hrs•find / -mtime 1
• spot largest files (numeric sort on 5th col)•ls –lR | sort +4n
• find which process uses most memory•ps aux | sort +4n
• Check available space•df -h
Linux Overview
• find packages containing string
rpm –qa | grep string
• find files installed by a packagerpm –ql <package name>
• find all files installed by Open Office packagesrpm –ql $(rpm –qa| grep openoffice) | less
• find all files installed by each packagefor i in $(rpm -qa | sort); do echo $i; rpm -ql $i; done
Practical aspects – the package manager
Linux Overview
Practical aspects – patching the system
• System updates– deal with
• software bugs
• vulnerabilities
– dependency checking• up2date – use the source
• apt, yum
Recommended