file permission in linux

10
Basic File Permissions Basic File Permissions

Upload: prakash-poudel

Post on 15-Aug-2015

23 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: File permission in linux

Basic File Permissions

Basic File Permissions

Page 2: File permission in linux

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

Access Levels

- rwx rwx rwx

- Filed Directoryl links

Owner Primary Group Others

Page 4: File permission in linux

Access Modes

Permission

Absolute Mode4 2 1

Symbolic Moderwx

Page 5: File permission in linux

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

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

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

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

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

Changing Ownership

Changing ownership of a file or directory [root@power_pc]# chown <user name/group name> <file/dir name>