Chmod Exercises

chmod Practice

Create a new file called chmod.exercises.

Question: What are the default permissions for the new file?

CLICK FOR ANSWER

-rw-rw-r--:

  • owner: Read and Write
  • group: Read and Write
  • all others: Read

Bonus Question: What was the command to view the file permissions?

CLICK FOR ANSWER

ls -l chmod.exercises

Change chmod.exercises permissions to -r--r--r--

Change the file permissions to Read only for the owner, group and all other users.

Question: What was the command for changing the file permissions to -r--r--r--?

CLICK FOR ANSWER

chmod 444 chmod.exercises

Change chmod.exercises permissions to -rw-r-----

Change the file permissions to match the following:

  • owner: Read and Write
  • group: Read
  • other: no permissions (None)

Question: What was the command for changing teh file permissions to -rw-r-----?

CLICK FOR ANSWER

chmod 640 chmod.exercises

Change chmod.exercises permissions to -rwxr-x--x

Change the file permissions to match the following:

  • owner: Read, Write and Execute
  • group: Read and Execute
  • other: Execute

Question: What was the command for changing the file permissions to -rwxr-x--x?

CLICK FOR ANSWER

chmod 751 chmod.exercises

Note

After completing the exercises feel free to delete the chmod.exercises file.