Ace your COMPTIA A+ certification with our practice exam. Engage with a variety of questions including multiple choice and performance-based, complete with hints and detailed explanations. Prepare effectively and boost your confidence for the big day!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


How do you add group write and execute permissions to myfile.txt in Linux?

  1. chmod g-wx myfile.txt

  2. chmod g+x myfile.txt

  3. chmod g+wx myfile.txt

  4. chmod u+wx myfile.txt

The correct answer is: chmod g+wx myfile.txt

In Linux, permissions can be assigned to a file for the file owner, groups, and everyone else. The chmod command is used to modify these permissions. Options can be combined to set multiple permissions simultaneously. In this scenario, the correct command to add group write and execute permissions to myfile.txt is "chmod g+wx myfile.txt". Option A, "chmod g-wx myfile.txt", would only remove group write and execute permissions, but not add them. Option B, "chmod g+x myfile.txt", would only add group execute permission, but not group write permission. Option D, "chmod u+wx myfile.txt", would add write and execute permissions for the file owner, not for the group.