- Owner - The user who owns the file
- Group - Set of users
- World - Not owner and not part of Group
Following permission can be granted:
You can use
chmod
command to set the permissions for each group (
Owner/User/World
) by applying desired (
Read/Write/Execute
)
tags to each one of them. The digits which are used to set the
permissions are actually the decimal representation of the binary (
0/1
) flags which set per group. For example, you want to set permissions which will allow the following:
- Owner - read, write and execute
- Group - read and execute (but not write)
- World - no permissions
So in that case for
Owner
we will have:
read=1
,
write=1
and
execute=1
resulting in permission:
111 -> 7
The
Group
will have:
read=1
,
write=0
and
execute=1
resulting in permission:
101 -> 5
And finally the
World
will have:
read=0
,
write=0
and
execute=0
resulting in permission:
000 -> 0
Additionally, you can set a what is called the
sticky bit
to a directory. It will prevent other users from deleting or renaming
the files within that directory. Only the owner can delete or rename the
files within that directory. So in your case, the correct
chmod
command will look like this:
chmod 1777 temp
Where
777
allows
read/write/execute
for all three groups and the additional
1
is the
sticky bit.
Comments
Post a Comment