Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Linuxzoo Permissions Questions: Write the commands to execute the following ques

ID: 3814482 • Letter: L

Question

Linuxzoo Permissions Questions: Write the commands to execute the following questions

Question 2: Octal Code

What is the octal value for the permissions on /home/demo/bigfile?

Question 3: Other Permissions

What is the "other" permissions on /home/demo/bigfile?

Question 4: Remove read and execute

Take away from the scripts directory read and execute (search) permission for yourself ONLY.

Question 5: Impact of no rx

What did removing read and execute do to you ability to look into scripts?

Question 6: Add read

Add in read access for yourself on the scripts directory.

Question 7: Impact of no x

What did restoring read access do to you ability to look into scripts?

Question 8: Add execute

Restore the directory scripts to read,write,execute for the owner, and read and execute for both others and group.

Question 9: umask

What umask setting would be required to give, when creating a directory, read/write/execute for yourself, read and execute for group, but only execute for others?

Explanation / Answer

Question 2: stat -c "%a" /home/demo/bigfile

stat command is used to display file status. Option -c or --format specifies the format of output. With -c, when you give "%a", it prints permissions in octal for the given file. It returns a three digit octal value (say, xyz) where,

x = permissions for the current user (owner)

y = permissions for the group

z= permissions for others

Question 3: To check permissions for "others", use the above stat command or "ls -l /home/demo/bigfile"

ls -l command returns info about the file in which the first column shows permissions.

The format is something like -rwxr-x--x.

- indicates file. If there is a d present in this place it indicates directory.

The first three indicate permission for the owner. The next three indicate permission for the group and the last three are permission for "others". - here indicates the permission is not set.

r - indicates read permission

w - indicates write permission

x - indicates executable permission

If you are finding out permissions with stat command in octal the last digit indicates permission for others.

7 - rwx 6 - rw 5 - rx 4 - r 3 - wx 2 - w 1 - x 0 - none

To get permissions in human readable form using stat command, use stat -c "%A" /home/demo/bigfile

Question 4: To modify permissions of a file or directory, use chmod command.

chmod u-rx scripts/ u denotes user. - denotes revoking a permission (+ to give permission). r - read, x - executable

Question 5: By removing read and execute, you are denied to enter or access the directory and its contents.

Queston 6: Again to modify permissions you need to use chmod command. To give read permission to self,

chmod u+r scripts/

Question 7: Even without x, after restoring read permissions, user can access the directory.

Question 8: To modify permissions we use chmod command.

chmod u+rwx,g+rx,o+rx scripts/ u - user, g - group, o - others. + denotes adding permissions

Question 9: umask command is used to give permissions to a directory when creating it. It masks a set of permissions based on the input thus creating new default permissions.

umask in human readable form. umask u=rwx,g=rx,o=x

umask in octal. umask 0026

first 0 is for special permissions.

second 0 creates NO mask on user thus giving him all the permissions (rwx)

2 creates mask on WRITE bit for group thus giving it only read and execute permissions

6 creates mask on READ and WRITE bit for others thus giving it only execute permission.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote