Which command is used to set the SetUID permission on the executable /bin/foo?

Prepare for the LPI 101-500 Certification Exam. Utilize flashcards, navigate multiple choice questions, and benefit from hints and explanations. Begin your Linux certification journey today!

Setting the SetUID permission allows a user to execute a file with the permissions of the file owner, which is particularly useful for executable files that need elevated privileges. In this case, to set the SetUID permission on the executable /bin/foo, the command chmod 4755 /bin/foo is correct because it employs the octal notation for setting permissions.

The number 4 at the beginning of 4755 specifies that the SetUID permission is being set, as the leading digit represents the special permissions. The subsequent digits (755) indicate the usual read, write, and execute permissions for the owner, group, and others. Specifically:

  • The owner has read, write, and execute permissions (7).

  • The group has read and execute permissions (5).

  • Others have read and execute permissions (5).

This combination allows the /bin/foo executable to run with the effective permissions of its owner, which is typically necessary for programs that require elevated access to system resources.

Other options provided do not correctly set the SetUID bit. For instance, the second choice incorrectly uses a leading 1, which would set a sticky bit rather than SetUID. Meanwhile, the third choice using 755+s is not valid in standard

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy