Вы находитесь на странице: 1из 12

Modules

Thursday, March 7, 2019 3:52 PM

MODULE 1: Introduction to System's Administration


• System Administrator
– Responsible for setting up and maintain the systems
– Referred to as the superuser or root
• 3 Major Roles of System Administrator
– Hardware
* Creates and maintain a diagram of the system
* Verify computer peripherals
* Monitor the performance of the hardware components
* Arranged and repair hardware failure
* Needs to know diagram of PC system
* Partitioning hard disk dirve

– Software
* Knows the installation process ( install and configure the UNIX 0S)
* To configure, install or uninstall applications (create the filesystem
* Know how to setup scheduled jobs (monitor system resource usage)
* Manage file integrity
* Create a file system: tuning up, compress file, extension
* Two Types of Files
▪ Logical Partition
▪ LVM
* Setup quota under specific users
– Users and Group Accounts
* Create and modify users and groups
* Customize user accounts
* Setup specific users that can have admin privileges
* In Module 3
Root is always used
/home/unixuser
/root
$ - user
# - root

MoDULE 2: Installation
• 3 Types of Partition
– Primary
* Has a limit number of partitions inside a single hard disk
* Maximum is 4
– Extended
* Also a primary type but can contain sub-partitions, multiple partitions
* For instance: 2 primary but 1 extended
* Also considered a primary partition type
– Logical
* Sub partitions of an extended type partition
* If extended is deleted, then logical partitions will be deleted
* Always start sda, start at partition 5
• /dev/sda
– Means primary partition of disk
– Can be configure under SATA/SCSI
• /dev/sad1
– Means first partition disk of a (sda)
• Acronyms
– SATA (sta) : serial advance technology attachment
– PATA (hda) : parallel advance technology attachment

UNIX_2 Page 1
– PATA (hda) : parallel advance technology attachment
* It much preferable since faster since it is parallel
– SCSI: small computer system interface
* A serial cable, can manage multiple hard disk drives
– The SATA is advantage than PATA since malaki ung space
• Examples:
– Give the device filename 3rd primary partition of 2nd PATA disk

*
– Give the device filename 5th logical partition of 3rd SATA

• Setting up the UBUNTU


First. In setting up the partition, go to something else,
/ P4 4G
/boot L 1GB
/var L 3GB
/usr L 4GB
*
/tmp L 1GB
/opt L 4GB
/home L 4GB
Swap L 4GB
Second. Create the unixuser
Third. To go the root, set password to root, use passwd root
* Passwd: Unix09

MODULE 3: Account Administration


• 2 Default User created by Linux
– Root
– Unixuser (arbritary ung name)
• /etc/passwd
– The fields: VERY IMPORTANT
* username:passwd(encrypted):UID:GID:comments:homedirectory:loginshell
– In password:
* X - means the encrypted password is not mas out in /etc/passwd but in /etc/shadow
* * - the account is locked
– UID
* User id
* Can have the same user id since the system allows it but shouldn't be the case
▪ If it does happen if user1 and user2, then whatever will happen to user1 will happen to user2.
* System IDs: starts at 1-99
* Admin IDs: start with 0
* Users ID: start with 1000 and increments
– Comments
* Only allowed in spaces
* Information: full name
– homedirectory
* It is in absolute pathname
* Has its own permission inside, because it owns the file.
• /etc/gshadow
– For group
– groupname passwd:GIP:groupmembers
• Commands for user administration
– useradd [-option] username
* Option:
▪ -u -> UID
▪ -c -> Comments

UNIX_2 Page 2
▪ -c -> Comments
▪ -d -> home directory
▪ -s -> shell
▪ -g -> GID
▪ -D
 Views the default settings
▪ -m
 /etc/skel
◊ List of files sometimes hidden, whenever you add the content of the /etc/skel directory
will be in to the home directory of the newly added user.
– usermod [option argument]
* Modifying an existing account
* It uses the same option of useradd except -m
* It can change id of the one user
– userdel [option]
* Option:
▪ -r -> remove
 Removes, including the home directory
▪ -rf -> removes forcefully
– passwd username
* Changes the password
• Commands for group administration
– groupadd [-g groupID] groupname
* -p -> password
– groupmod [-g groupID] groupname
– groupdel groupname
• vipw
– Shortcut to vi editor /etc/passwd
– Checks if tama ung syntax
– Safer to use
• pwck
– Check syntax errors in /etc/passwd
– Checks also the /shadow
• grpch
– Checks syntax errors in /etc/group
– Checks also in /gshadow
• /etc/default/useradd
– Edits the setting in vi
• chage [-option] unixuser (OTHER COMMAND)
– Allows to view the password expiration
– If account expires, it is locked out
– If password expires, it is only the password not the entire account.
– Option:
* -l
▪ Views the password expiration
* -M
▪ Maximum day, it reached the password is really expired.
* -m
▪ Minimum day, warning lng
* -E
▪ Account expires, date

• Examples:
1) Creates a username user1 with UID=1234, home directory=/dir1/user1 and contents of skel copied to
user1
First. Create the home directory: mkdir /dir
Second. Add the user by command: useradd -u 1234 -d /dir1/user1 -m user1
Third. Add the password by command: passwd user1
2) Change primary group name of user1 to group123
First. Create group: groupadd -g 12345 group123
Second. usermod -g 12345 user1

UNIX_2 Page 3
Second. usermod -g 12345 user1
Third. To check su user1, then id
3) Create a user name user2 with UID=1235, shell = /bin/sh without using user add
First. vi /etc/passwd, goes to the last line (shift+G) and copy the last (yy then go to newline then
paste)
Second. user1:x:1234:12345:/dir1/user1:
Use P to paste after the cursor
user2:x:1235:12345:/home/user2:/bin/bash
Third. vi /etc/shadow (for password), goes to the last line (shift+G) and copy the last (yy then go to
newline then paste)
Fourth. mkdir /home/user2
Fifth. To change ownership: chown user2 /home/user2

MODULE 4: User Account Customization


• Modify files
• Login()
1) System Login script
* All users are affected
* At /etc/profile
2) Personal login script
* Check individually
* At $HOME/bash-profile or $HOME/.profile
* Overides SYSTEM LOGIN SCRIPT
3) Personal Shell startup script
* At $HOME/.bashrc
* Overides the PERSONAL LOGIN SCRIPT AND SYSTEM LOGIN SCRIPT
* Ovrides the PERSONAL LOGIN SCRIPT AND SYSTEM LOGIN SCRIPT
• apt-get update
– apt-get update
* Update the system, allows adding things in the ubuntu files
– apt-get install sysbanner
* Banner, greets the user
– apt-get install finger
* Related system
* Location of mail
* Much more descriptive display
• Examples:
1) Change the prompt to # of the root only
First. Login at root
Second. vi $HOME /.bashrc
Third. Shift g then shift a entr
Fourth. In newline type 'PS1="#" or anyting you.'
Fifth. SAVE
2) Have a banner for all users
First. vi /etc/profile
Second. Shift g then shit a
Third. In newline type 'banner Hello Unix 2'

MODULE 5: Administration Privilege on User Accounts


• sudo
– Always been given for a created account
– -l
* List all sudo commands
– /etc/sudoes
* Edit the sudo command
* If its in nano: to cancel nano
▪ Command: export EDITOR=vi
* 'USERNAME HOST' = ('USER:GROUP) COMMAND
▪ For host
 If more than one separate by commas
 Can have the /24 addressing
▪ For user

UNIX_2 Page 4
▪ For user
 Whatever users are equal to USER, it will reflect the commands of USER
▪ For Commands
 Should always be an absolute path name
▪ Example:
 Hi host1=(ALL) /usr1/sbin/useradd, /usr1/sbin/usermod
▪ List of aliases
 User_Alias: for username
 Cmnd_Alias
 Host_Alias
 Runas_Alias: for user
 Format: Alis aliasname = value
• Examples:
1) Using aliases, allow commands chgr and chown to be executed by user1 and user2
First. User_Alias USERS=user1,user2
Second. Cmnd_Alias COMMANDS=/bin/chgrp,/bin/chown
Third. USERS ALL=(ALL) NOPASSWD:COMMANDS
* sudo !! -
▪ Executes the previous commands, only in bash
* The order doesn't matter

MODULE 6: Initialization, Bootup and Runlevels


• Hardware systems
1) Activated BIOS:
* to have interfacing with processor and hard disk (kasi na dun ung os)
2) Activated MBR:
* master boot record, contains 'the something for the bootloader'
3) Activated Bootloader:
* allows to select between what OS to load, does not contain the OS itself.
* Nasa MBR sya.
* Ignored if single boot
4) Activated Kernel
* Design to interface between hardware and software
5) Init
* Mother of all process
* PID 1
* Daemon
▪ Background process that usually started at bootup
▪ Crond
▪ Login
– Runlevel
* Bootup mode
* Similar to runlevel values
▪ 0 - halt
▪ 1 - single user (S)
▪ 2 to 5 -disto, specific levels
▪ 6 - rebot
* Commands:
▪ N: means bot been change or the previous runlevel
▪ init runlevel
 Changes the runlevel
▪ init 6: reboots
▪ init 0: halt or poweroff
▪ Shutdown [-option]
 Flexible
 -h : halt
 -r : reboot
 -p : power
 -y : always yes
 -c : cancel
▪ telinit q?Q
 Reloads the configurations placed inside the inittab file

UNIX_2 Page 5
 Reloads the configurations placed inside the inittab file
 Exclusive for redhat machine
 /etc/inittabl
◊ Initialization can be edited here
◊ id:runlevel:action:process
* It runs at runlevel 1,2, and 3
* id01:123:wait:/sbin/rc2.d/crond
▪ dmesg
 Display the kernel loading messages during bootup
▪ /var/log/syslog
 Checks the system during bootup and dmesg

MODULE7: Boatloader
• 2 types of Loader
– LILO (Linux Loader)
– GRUB (Grand Unified Boot Loader)
– Main configuration file
* /boot/grub/grub.cfg
▪ It is not recommended to edit, instead use this /etc/default/grub
 Since its reflected
 Icheck nya muna ung ginalaw mo, pag may mali hindi gagalawin
▪ Use update-grub to check the /boot/grub/grub.cfg
* To display the timeout
▪ GRUB_TIMEOUT_QUIET=false
* To edit boot load
▪ GRUB_TIMEOUT=1O - this is counted in seconds

MODULE 8: Partitioning Disk Drive


• 2 types of partition:
– Whole disk partition
* Uses an entire disk for one partition
* For RAID in whole Disk
▪ One partition for one file system
 RAID (Redundant array independent disk):
◊ Multiple hard disks
1 TB /home
/boot

/home
2
 Disadvantage:
◊ If damaged cannot be accessed again. Must be replace with a new functional disk.
◊ Not allowed to increase or decrease the usage, not allowed to transfer spaces.
◊ Not allowed to unmount and dismount
◊ These disadvantages have been resolved in LVM
 File system: fragment (smallest unit)
 Why do we have /dev/sda2
◊ Kasi it is a subpartition of /dev/sda1
◊ Contains the sda5 to sda11

◊ Bakit may *
* Nandun ung os
* Ung unnag tinitignan pag load up

▪ fdisk block_device_filename_of_disk
 Take not, it is not the partition but the disk: /dev/sda
 Create a partition using the method of whole diskThis set of commands make you go
to the fdisk prompt.
First. fdsik /dev/sda
Second. m , means in shows the list of the command (You are now in fdisk prompt

UNIX_2 Page 6
Second. m , means in shows the list of the command (You are now in fdisk prompt
and removed in from Linux command)
Third. p , means information of the partition table (It is recommended to always
check the partition table in every command you make)
This set of commands help create a new primary partition
First. n means new
Second. p for primary if mistake has been made, press ctrl-C to go back to Linux
command
Third. Enter
1st. Partition number: 3 or enter-default
2nd. First Section (_ - _, default _ ): 42973184 (Just look at the previous
primary disk at copy but at the last number plus 1)
3rd. Last sector (per section, per size ): +1G (Always add +)
Fourth. p to check if has been created,
This set of commands to delete:
First. d :3 to delete
Second. p to check
This set of commands for ways of quitting in the fdisk command prompt.
First. q means quit without saving
Second. w means quit with save
 How to reflect (means see it apply)
– Init 6 reboot
– partprobe (Creating a file system)
First. partprobe
Second. mkdir /newfs (optional, since pwede existing)
Third. mkfs -t [file system type] 'partition name'
mkfs -t ext4 /dev/sda3
 Now have a file system ,create the mounting point (This is done by dynamic access)
First. mount [partition] [directory]
mount /dev/sda3 /newfs
 Associate partition with the file system
 No link with partition and file system, if there's no mount
For verification:
First. mount -v
Second. df -h to be it human readable
Third. cat /etc/mtab
 mtab - files containing mounted when performing unmount
Fourth. touch /newfs/file1
Fifth. cd /newfs
Sixth. ls -l
▪ fsck - assumed corrupted files are in lost+found (a directory created
every files in file system
 For unmounting
– Rules in Unmounting
* Processing running or using the fs should be terminated
* No users even root should be currently using the file system as its PWD
* Every files in mountpoint is hidden and un-accessible and needs to be unmount
to be accessible
First. unmount
 Even though nag umount, nakatago sya sa / ung file
 Check
 touch /newfs/file2
 df -h /newfs
Second. umount /newfs /dev/sda3
 Now have a file system ,create the mounting point (This is done by static access)
– Fstab file
Partition Mountp Fs Mount Dump can Pass fsckorder 0 if will not
device oint type options either be 0 perform a file system, the
* filename or 1 higher the value, the higher
priority
/dev/sda3 /newfs Ext4 Defaults 0 0

UNIX_2 Page 7
/dev/sda3 /newfs Ext4 Defaults 0 0
First. vi /etc/fstab
1st. Shift g and shift a then enter
2nd. /dev/sda3 /newfs ext4 defaults 0 0 (enter this in the newline)
Either go to first or second
First. mount -a
 Will perform mounting filesystem on fstab
 Pag wala sa fstab hindi nya ipeperform (check)
Second. mount /newfs (for specific)
 Checks fstab and hahanapin nya, checks the /dev/sda3
Third. mount -v
Fourth. Init 6
Fifth. mount -v | grep sda3 - to check if mounted
▪ Example:
Create a 2 GB partition using /dev/sda3 with statically mounted on filesystem1
First. fdisk /dev/sda
Second. p
Third. Enter
Fourth. n
Fifth. Can either be 'enter' only or
1st. p for primary
2nd. l for logical
Sixth. Partition number: 3
Seventh. First sector: 42973184
Eighth. Last sectior: +2G
Ninth. p
Tenth. w
Eleventh. partprobe
Twelfth. mkdir /newfs
Thirteenth. mkfs -t ext4 /dev/sda3
Fourteenth. vi /etc/fstab
1st. Shift g and shift a then enter
2nd. /dev/sda3 /newfs ext4 defaults 0 0
Fifteenth. mount -a or mount /newfs

MODULE 9: File System


• Hierarchy
1) /
2) Bin (binaries, access for users)
3) Boot (grub)
4) CDrom
5) Dev (device files)
6) etc
* (configuration files) - editable text configuration
7) Home
* Where users are directed when logging in
8) lib
* Files are managed and accessed by developers
* Usually in c
9) Media
* Default mount point of removable media or devices
* Automatic
10) mnt
* Same like media but it is manually
11) Opt
* Optional add-ons
* Vendor specific, not created by linux develops
* Created by third-party vendors
12) Usr
* System files
* Contains documentation or manual pages

UNIX_2 Page 8
* Contains documentation or manual pages
13) Proc
* Special type filesystem, has mounpoint on its own and separated partition even when not during
installation
* Are critical,
* All related to processor, motherboard
14) Root
* Home directory of administrator
15) Run
* Similar with the /sys
* Obsolete filesystem
* Commonly uses in other types of linux, that separates the file sys
* Kernel is placed here
* Is a partner of sys
* Mas importante ung na kay sys
16) Sbin
* Binaris that can executed by administrator or root
17) Var
* Log file
▪ Contains a series of messages informs you what happening in your system
▪ /var/log/system - main system file
▪ /var/spool - queues for hardware
18) Srv
* Created by users for the company
19) Tmp
* World writetable file
* Anyone can access and edit it

• Dynamic (always change)


– Home
– Var
– Tmp
– Srv
– root

• Static
– Cdrom
– Boot
– Opt
– Dev
– Lib
– Media
– Mnt
– Lib64
– Sys
– Run
– Usr
– Sbin
– Bin
– Lost + found

• Components of file system


1. User data
– Mismong content
– The one with the byte size, etc
2. Metadata
– This contains information related to the file or the filesystem itself
a. Superblock
▪ descriptive information related to the filesystem, that consumes the file space,
b. Inode
▪ unique identifier your file in your filesystem specificying the location, the more inodes, the more
number of files you can create (ls –i /home/unixuser)

UNIX_2 Page 9
number of files you can create (ls –i /home/unixuser)
1. They are hardlinks
2. Files can have the same inode, and created by hardlinks
c. Inode mapping
▪ Related to directory entry
• File system types
1. Ext2
– Second extend file system
– Incapable of recovering from a sudden shutdown of pc
2. Ext3
– Resolves the problem of ext2
– Introduces a file system online journal,
* Snapshots of what you are doing
* Can easily be recovered once the system goes back up
* Online journal, most stable state and status
– Disadvantage, unable to handle very large files and large capacity
3. Ext4
– Resolves the problem of ext3
– Handle capacity more than 32 tB capacity storage, and more than 1 TB files
4. Reiser FS
– (reiser fs)
– Best use to handle if files that are so many but sizes are so small
* By making the metadata are compact, not to consume that is allotted for the user data
* Superblocks are too many, nagiging fragmentation
* Easier to perform defragmentation
5. HPFS (high performance file system)
– hfs
– Hpux (hp)
6. VXFS (Ventas File System)
– Use if solaris
– vxfs
7. ISO 9660
– File system type of cd
– iso966
8. MDOS
– Microsoft disk operating system
– msdos
9. NTFS
– Removable flash drive
– New technolog file system
10. FAT file allocation table
11. Joliet
– Cd
– (joliet)
12. ZFS (zettabyte file system )
– Exclusive for Solaris file system

MODULE 10: Managing Devices


• Can handle via device files
• 2 types of device files
– Block
* 6 bytes per block
* Less accurate mag transfer ng data
* Files not suitable that priority accuracy than speed
* Disk devices (tape, cds, flash drive)
– Row / character
* Files that priority accuracy rather than speed
* Devices, printer, plotter, tape, cartridges, terminals, modems all devices that require graphical
images.
– Main difference is how to and from transfer cache
• 2 types of numeric information

UNIX_2 Page 10
• 2 types of numeric information
– Major [num]
* Kernel driver [num]
* Fixed
– Minor [num]
– Physical location of the device
– How to view major and minor
First. cd /dev
Second. ls -l | head

– 0XAABBC
* AA - Interface card [num]
* BB - SCSI target address (Bawat raid na connected dun sa interface card natin)
* CC - LUN (logical unit numbers)

• Create a device file


First. mkmod nameofdevicefile b/c major# minor#
mkmod /dev/example123 b 64 0X010102 naka decimal lang sya sa ls -l
Second. ls -l /dev | grep example123
• Psuedo-devices
– False devices
– Though it is existing but it is not
1. /dev/null - blackhole
* Everything redirected to this files, disappears. Not anymore accessible.
2. /dev/zero
* Grab a series of null values depending on the file size you are going to create
* Null Size example: Create a size file you desired that is full of null size
First. dd if=/dev/zero of=/home/file1 bs=10000 count=1000
Second. ls -lh /home/file1
Third. cat /home/file1
3. /dev/full
* If file is redirected to /dev/full, doesn't allow to write or overwrite
* Full Size example:
First. dd if=/dev/zero of=/home/file2 bs=1000 count=1000
Second. echo hello >> /home/file1
echo hello >> /home/file2
4. /dev/random
* Generate a random number
• Can handle devices by modules
– Library files ung paccess sa devices
– lsmod command
* Used by - (indicates the dependencies
* Depended-on modules, will not work if modules are not installed.
– modinfo [module name] command
* Relevant information of the part port

UNIX_2 Page 11
* Relevant information of the part port
* Mod example: remove parport and then install again
First. rmmod lp ppdev parport pc (uninstall dependencies)
Second. rmmod parport
* Ways to install devices files by modules
First. modinfo lp
Second. msmod /lib
-use TAB to complete error
Error kasi hind pa install ung parport
Third. mod info parport
Fourth. ins mod /lib
Fifth. Go to Second
* Easier way
First. modprobe lp (automatic installation of the independent and other)
If lp is installed, then parport will also be installed as well.
If reboot, the system will automatically install it

MODULE 11: system Information


• System information cannot be edited easily since information is static
• /proc/cpuinfo
– Virtual process, can handle multiple threads
– top, w, uptime (commands)
* Uptime
□ Determines how long does your system rebooted
• /proc/meminfo
– Sizes of availability, buffers and cache
– Swap-virtual memory (mas mabagal kasi mas malayo)
– CPU > CACHE > RAM > SWAP
– top, free, -m (commands)
• /proc/interrupts
– Non-maskable interrupts
* Related to software
* Higher priority than maskable
• /proc/ioports
– Ranges addresses device name
• /proc/version
– cat /proc/version
– umname -a
* Shows kernel version
• /proc/bus/pcp
– PCPI as interface
– PCPI (peripheral component interface)
– lspcb (command shows info)
* -v
* Means verbose
• /proc/bus/usb
– Usb as interface
– lsusb (command shows info)

UNIX_2 Page 12

Вам также может понравиться