Linux
Linux
for Beginners
Bahador Bakhshi
[email protected]
Agenda
Introduction
Linux Distributions
Quick Start
Files
Process
Networking
Security
Introduction
Kernel Internal
System programming
Introduction
Security perspectives
OS role
Govern any things in computer
Has privilege
Insecure OS
insecure machine
Introduction
Why Linux?
Free
No charge
More secure
Open source
You see what happen, no hidden things
You need it
5
History
1960
1974 in AT&T
Free Unix
Free BSD
POSIX
Unix is commercial
MINIX
History
1991
Linus Torvalds
1994
Linux 0.0.2
Linux 1.0
Linux Logo
TUX
Now
linux-2.6.26, www.kernel.org
Multitasking, SMP, multi-user
Open source
Wide range of network protocols and services
Linux Distributions
What required
OS, kernel, kernel-space
Applications, user-space
Interfaces and basic commands
Applications
Services
Linux Distributions
SuSE
Supported by Novel
UBUNTU
Debian
10
Linux Distributions
Bluecat
LinuxPPC
Astaro
Live CD
11
Quick Start
Access to Linux
Remote
Local
Remote
Through network
Local
12
Quick Start
System powered on
BIOS
POST
Initialize Hardware
Kernel extraction
Kernel
Initialize Hardware
Quick Start
System Services
Configured Services
User interface
Graphical
KDE, GNOME
Text, Shells
Screen 7 is the X
14
Text vs. X
Contrary to MS Windows
X is just an application
Shell
Bash
$ : user
# : root
Commands in $PATH
Bash
Widecards
* : string
?: a char
IO redirection to file
: overwrite,
>
>> : append
<
: Read input
17
Bash
IO redirection to a process
Some short-cuts
CTRL-C: Stop
CTRL-Z: Suspend
Bash
Options are passed by - or -All system configurations are saved in text files
20
Man pages
Info pages
Documents in /usr/share/doc
Info pages
Easy to use
name>
whatis
21
Man pages
Very technical
searched in <MANPATH>
Mans
/usr/share/man
Internet documents
The Linux Documentation Project:
www.tldp.org
Tutorials
HOWTOs
Software home pages
Mailing lists
Everything is googlized
24
Files
Files can be
Regular file
Directory
Links
device
Files
Files system
man fs
/boot
/bin
/sbin
/lib
/etc
/home
/root
/var
/tmp
/usr
/opt
Additional softwares
/proc
/dev
/sys
Add new media and file system into your file system
List directories
ls
Options: -a -l -h -R
cd <path>
cd , cd , cd ~
pushd
popd
31
Make directory
pwd
32
Remove file
rm <file name>
rm -r <directory>
Secure remove
shred
shred -n 10 -z -v /tmp/xxx
33
mv <source> <destination>
34
Two Types
Hard
Soft
View Links
File Commands
Commands
File as an object
File content
-t : set time
File Commands
37
File Commands
Archive
File Compression
best compress: -9
z* commands
File Security
File permissions
ls -l
-rwxrwxrwx: -(user)(group)(other)
39
File Security
t: sticky bit. Others can not delete your file even with w
permission
Chang permissions
lsattr, chattr
40
File Security
Default permission
41
File Commands
Config files
Log files
Source codes
File type
Binary files
File Commands
What is in a file
File Commands
wc <file name>
Editors
Text Editors
X editors
X editors
gedit, kwrite
kate
45
Editors
emacs
mcedit
Difficult
vim
Three modes
Input mode
vim
Navigation commands
b : previous word
w : next work
:# : go to line #
48
vim
Edit commands
x : cut a char
p : past
u : undo
49
vim
50
Process
Foreground
Background
Foreground is default
51
Process
Background
52
Process
Priority
Process
Monitoring
Process
System Information
Shell
Executable applications
Shell (Bash)
.bash_profile
/etc/bashrc
.bashrc
57
Bash
Environment Variables
Bash
Define a variable
echo $ABC
ABC=This is test
printenv
59
Bash Script
Variables
All commands
60
Bash Script
Control statements
Example
vim test.sh
#!/bin/bash
for file in *; do
if grep -q $1 $file; then
echo Found in file: $file
fi;
done;
exit 0
chmod +x test.sh
./test.sh test
62
C programming
cpp: C preprocessor
cc: C Compiler
ld: Linker
C programming
Intermediate results
64
....
65
Installing programs
Binary format
Distribution depended
Source code
./configure
make
make install
Networking
Configurations
On line
Config files
67
Networking
Ubuntu: /etc/network/interfaces
Routing
68
Networking
DNS
/etc/resolve.conf
/etc/hosts
Host Name
hostname
/etc/hostname
69
Networking
70
Services
Linux services
Startup scripts
Configuration files
/etc, /etc/apache2
72
Security
Security
Network
Each user
Security
Process security
74
Network Security
IDS: snort
VPNs
IPSec: openswan
Secure services