A Linux engineer is setting the sticky bit on a directory called devops with 755 file permission.
Which of the following commands will accomplish this task?
A . chown -s 755 devops
B . chown 1755 devops
C . chmod -s 755 devops
D . chmod 1755 devops
Answer: D
Explanation:
The command that will set the sticky bit on a directory called devops with 755 file permission is chmod 1755 devops. This command will use chmod to change the mode of the directory devops to 1755, which means that the owner has read, write, and execute permissions (7), the group has read and execute permissions (5), and others have read and execute permissions (5). The first digit 1 indicates that the sticky bit is set on the directory, which is a special permission that prevents users from deleting or renaming files in the directory that they do not own.
The other options are not correct commands for setting the sticky bit on a directory. The chown -s 755 devops command is invalid because chown is used to change the owner and group of files or directories, not their permissions. The -s option for chown is used to remove a symbolic link, not to set the sticky bit. The chown 1755 devops command is also invalid because chown does not accept numeric arguments for changing permissions. The chmod -s 755 devops command will remove the sticky bit from the directory devops, not set it.
Reference: chmod(1) – Linux manual page; How to Use SUID, SGID, and Sticky Bits on Linux
Latest XK0-005 Dumps Valid Version with 136 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund