Escolar Documentos
Profissional Documentos
Cultura Documentos
LESSON 1
System
Configuration
Mdulo: Administracin de Sistemas Linux
Configuration parameters
Arguments for respective daemons
Custom options for commands
System defaults
Kernel information
Much more
Mdulo: Administracin de Sistemas Linux
init: This file controls how the system appears and functions
during the boot process.
Mdulo: Administracin de Sistemas Linux
Files in /proc
Mdulo: Administracin de Sistemas Linux
Directories in /proc
Process directories are named after a programs
process ID (PID).
Directories in /proc
Directories group information concerning the kernel.
LESSON 2
Package
Management
Mdulo: Administracin de Sistemas Linux
# rpm qa
# rpm qi package_name
# rpm ql package_name
# rpm qf filename
# rpm qc package_name
Removing
# rpm e package_name
Mdulo: Administracin de Sistemas Linux
- /etc/yum.conf:
- /etc/yum.repos.d:
# yum grouplist
# yum groupinfo groupname
# yum groupinstall groupname
# yum groupupdate groupname
# yum groupremove groupname
Mdulo: Administracin de Sistemas Linux
LESSON 3
Automating
Task
Mdulo: Administracin de Sistemas Linux
Automating Task
- Utilities: cron, anacron, at, batch
- With the anacron you can run a job only once a day.
- With the cron you can run a job as often as every minute.
/var/spool/cron
/etc/anacrontab
/etc/cron.d
Mdulo: Administracin de Sistemas Linux
cron jobs
- cron jobs are defined in /etc/crontab.
minute: from 0 to 59
hour: from 0 to 23
day: from 1 to 31
month: from 1 to 12, or short name of month
day-of-week: from 0 to 7, or short name of day
user: user under which the jobs are run
command: shell command or script to execute
/etc/cron.d
Contains files with same syntax as the /etc/crontab
root privileges only
crontab
/var/spool/cron/<user>
at and batch
Sintax:
at time
LESSON 4
Sistem Logging
Mdulo: Administracin de Sistemas Linux
System Logging
Configuration
Global Directives
- specify configuration options that apply to the rsyslogd
daemon.
Modules
- rsyslog has a modular design. This enables functionality to be
dynamically loaded from modules.
$ModLoad <MODULE>
Rules
- A rule is specified by a filter part, which selects a subset
of rsyslog messages, and an action part, which specifies
what to do with the selected messages.
Mdulo: Administracin de Sistemas Linux
Configuration
Filters
- rsyslog offers various ways to filter rsyslog messages
according to various properties. A defined filter is called a
selector.
Actions
- Actions specify what is to be done with the filtered
messages.
Templatles
- Any output that is generated by rsyslog can be modified
and formatted by using templates.
Mdulo: Administracin de Sistemas Linux
Facility/Priority
- Messages are filtered based on two conditions: Facility and
priority.
Facility Priority
auth
cron debug
daemon info
kern notice
lpr warning
mail err
news crit
syslog alert
user emerg
Mdulo: Administracin de Sistemas Linux
Facility/Priority
- Examples: kern.*
mail.crit
cron.!info,!debug
- /etc/rsyslog:
Mdulo: Administracin de Sistemas Linux
Actions
- Save messages to log files
- Send messages over the network
- Send messages to specific users
- Execute a program
- Input messages to a database
- Discard messages
Examples:
cron.* /var/log/cron.log
*.* @host.com:18
Mdulo: Administracin de Sistemas Linux
Templates
Syntax:
$template <TEMPLATE_NAME>,"text %<PROPERTY>%
more text", [<OPTION>]
Templates
Example:
- $template verbose,"%syslogseverity%,
%syslogfacility%,%timegenerated%,%hostname%,
%syslogtag%,%msg%\n
/etc/rsyslog.conf:
Mdulo: Administracin de Sistemas Linux
LESSON 5
Kernel
Mode
Configuration
Mdulo: Administracin de Sistemas Linux
LESSON 6
Administration
Mdulo: Administracin de Sistemas Linux
Group information:
Group information is stored in /etc/group.
Each user has a private group (UPG).
Users can belong to more than one group.
Contents of /etc/passwd:
username:x:UID:GID:GECOS:home dir: shell
Contents of /etc/shadow:
username: hashed password: password aging inform.
Contents of /etc/group:
groupname: x: GID: comma-separated members
Contents of /etc/gshadow:
groupname: hashed password: GID: comma-separated
administrators: comma-separated members
Group passwords are rarely used.
Mdulo: Administracin de Sistemas Linux
To add a user:
useradd [options] user_name
To create a password:
passwd [options] user_name
To modify a user:
usermod [options] user_name
Example:
usermod aG 517 user_name
To delete a user:
userdel [options] user_name
Allows umask=0002
LESSON 7
File Systems
Mdulo: Administracin de Sistemas Linux
fdisk
cfdisk
parted
Disk Partitions
Partitioning divides a disk drive into logical disks.
/ (root)
/boot
swap
fdisk -l
Mdulo: Administracin de Sistemas Linux
Using fdisk
The fdisk utility is interactive.
d: Delete a partition.
l: List the known partition types.
m: Print the available commands.
n: Add a new partition.
p: Print the partition table.
q: Quit without saving changes.
w: Write the table to disk and exit fdisk.
Using fdisk
Mdulo: Administracin de Sistemas Linux
Using cfdisk
Mdulo: Administracin de Sistemas Linux
Using parted
Mdulo: Administracin de Sistemas Linux
ext3
Journaling version of ext2
ext4
Supports larger files and file system sizes
vfat
MS-DOS file system useful when sharing files between
Windows and Linux
Btrfs
Addresses scalability requirements of large storage systems
Mdulo: Administracin de Sistemas Linux
mkfs
Mdulo: Administracin de Sistemas Linux
blkid
Ejemplos:
Mdulo: Administracin de Sistemas Linux
Examples:
mount /dev/sdd1 /dir1
mount UUID=uuid_number /dir1
mount LABEL=label_name /dir1
umount /dev/sdd1
Mdulo: Administracin de Sistemas Linux
Ejemplos:
Mdulo: Administracin de Sistemas Linux
Swap space
Swap space is used when there is insufficient RAM.
swapon {device|file}
swapoff {device|file}
Mdulo: Administracin de Sistemas Linux
Swap space
Ejemplo:
Mdulo: Administracin de Sistemas Linux
LESSON 8
Access Security
and
Permissions
Mdulo: Administracin de Sistemas Linux
Authentication
You are prompted for the student user password, not the
root user password.
Mdulo: Administracin de Sistemas Linux
Controlling Access to Files
- ls command
- chown command
- chgrp command
- chmod command
Mdulo: Administracin de Sistemas Linux
Files Types
Symbol Description
d Directory
l Symbolic link
s Socket
D Door
P Named pipe
r Read File Designated users can open and read the contents of a
file.
w Write File Designated users can modify the contents of the file or
delete the file.
- Denied File and Designated users cannot read, write, or execute the file.
Directory
Mdulo: Administracin de Sistemas Linux
Special File Permissions
0 --- No permissions
1 Sticky bit
2 setgid
4 setuid
Mdulo: Administracin de Sistemas Linux
LESSON 9
Network
Configuration
Mdulo: Administracin de Sistemas Linux
Network Interfaces
Network Interfaces
DEVICE=eth0
BOOTPROTO=none
TYPE=Ethernet
HWADDR=00:16:3E:00:01:02
IPADDR=192.0.2.102
NETMASK=255.255.255.0
Mdulo: Administracin de Sistemas Linux
/etc/resolv.conf:
Provides access to DNS
Identifies DNS name server(s) and search domain
ifconfig is used:
At boot time to configure kernel-resident network
interface
To display the status of an interface
To configure (non-persistent) properties
Mdulo: Administracin de Sistemas Linux
Command-Line Network Interface
Utilities
ethtool
ethtool is used to query and set low-level network
interface properties.
Changes made by ethtool do not persist after a
reboot.
Mdulo: Administracin de Sistemas Linux
Address Resolution Protocol (ARP)
route Utility
route Utility
NetworkManager:
Dynamically detects and configures network
connections
Includes a GNOME Notification Area applet
NetworkManager
system-config-network Utility
# system-config-network
Mdulo: Administracin de Sistemas Linux
Device Configuration
Mdulo: Administracin de Sistemas Linux
DNS Client Configuration
Mdulo: Administracin de Sistemas Linux
LESSON 10
OpenSSH
Mdulo: Administracin de Sistemas Linux
Configuration Files
Global files are stored in the /etc/ssh directory.
Configuration
Server:
Client:
Examples:
# ssh host03
# ssh student@host03
# ssh host03 ls
Mdulo: Administracin de Sistemas Linux
Examples:
# scp host03:test_2 .
# scp host03:test_2 test_3
Mdulo: Administracin de Sistemas Linux
- Private key
- Public key