Basic File Permissions
Basic File Permissions
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
namesSize
Access Levels
- rwx rwx rwx
- File
d Directory
l links
Owner
Primary
Group
Others
Access Modes
Permission
Absolute Mode
4 2 1
Symbolic Mode
rwx
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
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
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
Example of Permission: Absolute
Applying permission to owner(u), group(g) and others(o) on file reports
[root@power_pc]# chmod 754 reports
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
Changing Ownership
Changing ownership of a file or directory
[root@power_pc]# chown <user name/group name> <file/dir name>

File permission in linux

  • 1.
  • 2.
    File and DirectoryAttributes -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 namesSize
  • 3.
    Access Levels - rwxrwx rwx - File d Directory l links Owner Primary Group Others
  • 4.
  • 5.
    Access Modes Access ModeFile 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
  • 6.
    Default Permission File Directory Created byroot rw-r—r-- 644 rwxr-xr-x 755 Created by user rw-rw-r-- 664 rwxrwxr-x 775
  • 7.
    Modifying the Permission Modifyingthe 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
  • 8.
    Example of Permission:Absolute Applying permission to owner(u), group(g) and others(o) on file reports [root@power_pc]# chmod 754 reports
  • 9.
    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
  • 10.
    Changing Ownership Changing ownershipof a file or directory [root@power_pc]# chown <user name/group name> <file/dir name>