File permission in linux
-
Upload
prakash-poudel -
Category
Engineering
-
view
23 -
download
2
Transcript of File permission in linux
![Page 1: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/1.jpg)
Basic File Permissions
Basic File Permissions
![Page 2: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/2.jpg)
File and Directory Attributes
-Unix/Linux files have 8 attributes that can be seen with ls –l command.
-rw-r—r-- 1 root root 1229 Aug 20 6:20 reports
si
Note: only the owner or the root can change the permissions.
root@powerpc# ls –l reports
Type
permissions
links owner
Owner’s primary group
Date File names Size
![Page 3: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/3.jpg)
Access Levels
- rwx rwx rwx
- Filed Directoryl links
Owner Primary Group Others
![Page 4: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/4.jpg)
Access Modes
Permission
Absolute Mode4 2 1
Symbolic Moderwx
![Page 5: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/5.jpg)
Access Modes
Access Mode File Directory
r 4 To display the content of the file To list the contents of the directory
w 2 To modify or append to the file To create or remove files of directories
x 1 To execute the file To enter into the directory
![Page 6: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/6.jpg)
Default Permission
File Directory
Created by root
rw-r—r-- 644 rwxr-xr-x 755
Created by user
rw-rw-r-- 664 rwxrwxr-x 775
![Page 7: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/7.jpg)
Modifying the Permission
Modifying the Permission[root@power_pc]# chmod <permission/weight> <file/dir>
Options:
Category u(owner) g(group) o(others)
Operators + - =
Permissions r w x
Weight 4 2 1
![Page 8: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/8.jpg)
Example of Permission: Absolute
Applying permission to owner(u), group(g) and others(o) on file reports[root@power_pc]# chmod 754 reports
![Page 9: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/9.jpg)
Example of Permission: symbolic
Applying permission to owner(u), group(g) and others(o) on file reports[root@power_pc]# chmod u=rwx, g=rx o=r reports
![Page 10: File permission in linux](https://reader036.fdocuments.us/reader036/viewer/2022071800/55ce6cb5bb61eb8d7e8b4707/html5/thumbnails/10.jpg)
Changing Ownership
Changing ownership of a file or directory [root@power_pc]# chown <user name/group name> <file/dir name>