Linux and Command-Line Basics

On many Linux systems, "ls -l /usr/bin/passwd" shows "-rwsr-xr-x 1 root root ...". Which of the following is the meaning of the "s" in the owner's execute position?

  1. Asetuid is set, so whoever runs it, the program runs with the privileges of the file's owner (here root)
  2. BThe sticky bit is set, so users other than the owner and root cannot delete or rename this file
  3. CIt indicates that this file is a shared library, which is only called from other programs and cannot be run directly as a command
Show answer and explanation

Answer: A. setuid is set, so whoever runs it, the program runs with the privileges of the file's owner (here root)

s means that both the setuid (set user ID) bit and execute permission are set, and the program runs with the privileges of the file's owner rather than of the user who ran it. passwd must update /etc/shadow, which only root can write, when an ordinary user changes their own password, so it is a setuid-root program. A flaw in a setuid program can become a foothold for an ordinary user to gain root privileges, so the bit must not be set carelessly. In octal it is the 4000 place, and chmod 4755 gives -rwsr-xr-x.

  • A. Correct. It runs with the privileges of the owner, root, rather than of the user who ran it.
  • B. The sticky bit is shown as "t" in the others' execute position (drwxrwxrwt for /tmp, for example). Set on a directory, it lets only the owner and a few others delete files in it.
  • C. Whether a file is a shared library does not appear in the permission notation. s is a mark about the privileges used when the file is run.
Practice this topic Back to topic

Books on Linux and Command-Line Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Linux and Command-Line Basics questions

  1. When the commands above are run in order, which of the following is the content shown by the last cat?
  2. As shown above, in a directory where a.txt exists and nofile does not, the last command is run. Which of the following is the result?
  3. In the session above, which of the following is the value printed by the last command?
  4. In the session above, which of the following are the lines printed by the last grep?
  5. The choices omit the leading spaces of the line. In the session above, which of the following is the line printed by the last pipeline?