In: Computer Science
in linux operating systerm - for the file –rw—wx-rwx foo.txt use symbolic representation change the permissions so that
a) The Owner and the group do not have any permissions. Others can open it.
b) The owner can write to it. The group can open it. Others will not have any permissions.
c) Only others have permission to open it.
d) Only the owner can open it.
In linux operating system, 'chmod' command is used to change the permissions of files according to mode. Here mode can be specified with numbers or with letters.
Permissions:
In linux system, there are three sets of permissions(--- --- ---)
to any file or directory. The three sets are as follows.
User - Permissions to the owner
Group - Permissions to the group
Other - Permissions to the others.
Let us discuss about Numeric
mode:
This numeric mode is in the from of one to four octal digits (0-7)
and those are delivered by adding up read (4), write (2), and
execute (1).
As per given the
file has permissions that –rw--wxrwx
The first it represents weather it's a file or directory. Remaining 9 bits are as three sets of permissions to user(rw-), group(-wx) and others(rwx).
a) The Owner and the group do not have any permissions. Others can open it.
As per the requirement, user and group should not have any permissions and others can have only read permissions. So that for user(0+0+0), for group(0+0+0) and for others(4+0+0)
Command: chmod 004 foo.txt
b) The owner can write to it. The group can open it. Others will not have any permissions.
So that for user(0+2+0), for group(4+0+0) and for others(0+0+0).
Command: chmod 240 foo.txt
c) Only others have permission to open it.
This is same as first one.
Command: chmod 004 foo.txt
d) Only the owner can open
it.
So that for user(4+0+0), for group(0+0+0) and for others(0+0+0).
Command: chmod 400 foo.txt