inode permissions
DESCRIPTION
linuxTRANSCRIPT
![Page 1: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/1.jpg)
RH033
Red Hat Linux Essentials
Welcome!
![Page 2: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/2.jpg)
2
Objectives Day 4
Understanding Permissions Linux File system
Inodes Links Mounting Media Archives Compression
Introduction to string processing String Processing with Regular Expressions Finding and Processing Files Investigating and Managing Processes
![Page 3: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/3.jpg)
3
Understanding Permissions
![Page 4: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/4.jpg)
4
What is Permission ?
Specifies what rights are you granting to users to access the resources are available in the computer, so that important resources such as files are protected from unauthorized users.
![Page 5: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/5.jpg)
5
Methods of Implementing Permissions Symbolic Method Numeric Method
![Page 6: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/6.jpg)
6
Permissions- Symbolic Method Four symbols are used when displaying and applying permissions
● r Permission to read a file or list a directory’s contents● w Permission to write to a file or create and remove files from a
directory● x Permission to execute a program or change into a directory
and do a long listing of the directory● - no permission ( in place of the r, w, or x )
![Page 7: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/7.jpg)
7
Applying Permission with Symbolic Method
chmod command is used to change access modes Symbolic Method
● chmod u+w,go-w somefile file name
( Grants write access to owner but denies it to group and other. )
● chmod u=rw somefile file name
( Sets read and write permission to owner, with execute turned off, regardless of the current permission )
● chmod +r somefile file name
( Make the file world-readable )
[ Note : +, - and = are operators to add, remove or overwrite the permission ]
![Page 8: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/8.jpg)
8
Four numbers are used when displaying or applying permissions
● 4 Permission to read a file or list a directory’s contents● 2 Permission to write to a file or create and remove files from a
directory● 1 Permission to execute a program or change into a directory
and do a long listing of the directory● 0 no permission ( in place of the 4, 2, or 1 )
Permissions- Numeric Method
![Page 9: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/9.jpg)
9
Applying Permission with Numeric Method
chmod command is used to change access modes Numeric Method
● chmod 664 somefile file name
( Grants Read and Write access to owner and group but read only it to and other. )
● chmod 600 somefile file name( Sets read and write permission to owner, with execute turned off, with others and group have no permissions )
● chmod 444 somefile file name
( Make the file world-readable )
![Page 10: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/10.jpg)
10
![Page 11: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/11.jpg)
11
Others do not have write-
Others have readr
Group has executex
Group does not have write-
Group has readr
Owner has executex
Owner has writew
Others have execute
Owner has readr
x
Permissions
![Page 12: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/12.jpg)
12
Understanding File System
![Page 13: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/13.jpg)
13
Partition and File System Disk drives are divided into partitions Partition are formatted with file system, allows users to store data
● Default file system: ext3, the Third Extended Linux File System● Other common file systems:
● ext2 and vfat● iso9660 ( typically used for CDs)
![Page 14: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/14.jpg)
14
Inodes
An inode table contains a list of all files in an ext2 or ext3 file system
Directories have inode numbers associated with files. inodes contain information about the file or directory,
including:● Owner, group, permissions, size, location on disk, file type (file or
directory)
One inode is associated with each file. The system uses inodes as the definition of a file.
The ls -il command displays the inode number:
80977 drwxr-x--- 1 user user4096 Mar 19 11:23
![Page 15: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/15.jpg)
15
Links A link is a file that points to another file. “ln” creates a “link” from the original file to a new “file” in your directory. Most programs will access the link as if it was the file. This is similar to a “shortcut” in Windows. This allows for aliasing (when two or more names can exist for the
same object) Easy way to point to a really long absolute pathname or filename
![Page 16: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/16.jpg)
16
Using Links Two types of links can be created
● Symbolic ( Soft )● Hard
ln -s main soft
( This will create an soft link of file “main” )
ln main hard
( This will create an hard link of file “main” )
![Page 17: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/17.jpg)
17
Mounting the media “Mounting” means making a partition to access from an access point
typically a folder to store and access data from it.
Commands to mount media
mount /media/floppy = Mounts floppy drive to your computer
mount /media/cdrom = Mounts cdrom drive to your computer
mount /media/Device ID = Mounts usb disk to your computer
Commands to unmount media
umount /media/floppy = Unmounts floppy drive to your computer
umount /media/cdrom = Unmounts cdrom drive to your computer
umount /media/Device ID = Unmounts usb disk to your computer
![Page 18: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/18.jpg)
18
Archive Files Archiving places many files into one target file Easier to back up, store, and transfer tar – Standard Linux archiving command
![Page 19: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/19.jpg)
19
Using Archive files – tar command tar cvf archive_name files..
( To create archive file ) tar tvf archive_name files..
( To display files under archive file ) tar xvf archive_name files..
( To extract files from archive file ) tar rvf archive_name files..
( To append archive file )
![Page 20: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/20.jpg)
20
File Compression Results in smaller file size Text files can be compressed over 75% tar archives are often compressed
![Page 21: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/21.jpg)
21
Compression Utilities gzip, gunzip
● Standard Linux compression utility● Up to 75% compression for text files
bzip2, bunzip2
● Newer Linux compression utility● Generally achieves better compression than gzip
![Page 22: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/22.jpg)
22
Using Compression gzip somefile
( To create compressed file ) gunzip somefile
( To uncompress a compressed file ) bzip2 somefile
( To create compressed file ) bunzip2 somefile
( To uncompress a compressed file )
Note: - We can use z for gzip and j for bzip2 type of compression with tar
![Page 23: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/23.jpg)
23
Introduction to String Processing
![Page 24: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/24.jpg)
24
Head and Tail
Head shows the first lines of a file● Try head /etc/somefile● Try head -n 5 /etc/somefile (shows the first 5 lines of the file)
Tail shows the last lines of a file● Try tail /etc/somefile● Try tail -n 5 /etc/somefile (shows the last 5 lines of the file)
![Page 25: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/25.jpg)
25
wc, sort, uniq , cut and paste wc “Word Count”
● wc OPTIONS somefile ● Options ( -l , -w, -c )
sort “Sorting Order”● sort OPTIONS somefile● Options ( -r, -n )
uniq “Removes duplicate lines in a file”● -u to show only truly uniq● -d to show lines that are repeated in the input● -c to count lines
cut “ Display specific columns of the file data● cut –f3 –d: /etc/passwd
paste “Paste files together”● paste file1.txt file2.txt > file3
![Page 26: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/26.jpg)
26
aspell, expand aspell “To check spelling in file “
● aspell somefile expand “Expand tabs into spaces”
● expand tabfile.txt > result.txt
![Page 27: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/27.jpg)
27
String Processing with Regular Expressions
![Page 28: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/28.jpg)
28
grep , sed and awk grep “ Prints lines of files where a pattern is matched
● grep amit /etc/passwd sed “ Stream Editor :- Reads a file ; writes out the data performe
search and replace “● sed ‘s/big/small/’ somefile● sed ‘s/big/small/g’ somefile
awk “ Programming language for editing text “● awk ‘ /bash/ { print } ‘ /etc/passwd
![Page 29: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/29.jpg)
29
Finding and Processing Files
![Page 30: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/30.jpg)
30
slocate and find slocate “ Search for files “
● slocate somefile find “ Search for files “
● find /home –name somefile● find /home –iname somefile [ case-insensitive search ]● find /home –user amit –group amit somefile● find /home –perm 755● find /home –size 1000kb
![Page 31: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/31.jpg)
31
Investigating and Managing Processes
![Page 32: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/32.jpg)
32
What is a Process? A process in an executing program with several components and
properties. A process is a shell command or a program in execution. When you log in, a process is created. This process is executing the
shell When you execute a shell command, a new process is created. When
the command terminates, the new process dies. A single user can have many processes executing at the same time
![Page 33: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/33.jpg)
33
ps The command ps is used to determine the status of active processes.
The command returns the process id (PID) number and other information such as the amount of CPU time the process has used (TIME) and the command which invoked the process (CMD).
Options may be combined.
![Page 34: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/34.jpg)
34
Top
The command top is used to show a real-time view of Linux tasks top can be used to display the CPU/memory usage of each task top
![Page 35: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/35.jpg)
35
Terminate Processes
kill is used to terminate processes or to send signal to processes. Examples:
● kill PID ● Terminate the process with the process id (PID).
![Page 36: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/36.jpg)
?Questions
![Page 37: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/37.jpg)
What have we learnt ?
File Editing using vi editorAdvanced usage of vi editor Users and Groups ManagementUnderstanding PermissionsLinux File system
InodesLinksMounting MediaArchivesCompression
Using GUI shells ( GNOME & KDE)
![Page 38: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/38.jpg)
?Questions
Day 2 Complete !!!
![Page 39: Inode Permissions](https://reader038.vdocuments.us/reader038/viewer/2022103104/577cc7441a28aba711a07a73/html5/thumbnails/39.jpg)
Thank You !!!