chmod Special Permissions Quiz
22 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What happens when the Setuid bit is set on an executable file?

  • Users cannot execute the file.
  • Users can only read the file.
  • Users can run the file with their own permissions.
  • Users can run the file with the permissions of the file's owner. (correct)
  • The Setgid bit influences the permissions of an executable file only.

    False

    What is an example of a command that uses the Setuid permission?

    passwd

    The Setgid bit ensures that files created in a directory inherit the directory's ______.

    <p>group</p> Signup and view all the answers

    Match the following special permissions with their functions:

    <p>Setuid = Allows running a file with the owner's permissions Setgid = Allows running a file with the group's permissions Sticky Bit = Only file owner can delete their files in a directory SUID on directory = Files inherit the directory’s group</p> Signup and view all the answers

    What will the file permissions look like when the Setuid bit is set for the owner?

    <p>rwsr-xr-x</p> Signup and view all the answers

    The Sticky Bit is specifically used to grant elevated permissions to executable files.

    <p>False</p> Signup and view all the answers

    Which command would you use to set the Setgid bit on a directory?

    <p>chmod g+s directory</p> Signup and view all the answers

    What does the Setuid permission do?

    <p>Allows a file to run with the owner's permissions</p> Signup and view all the answers

    The Setgid permission ensures that newly created files within a directory inherit the owner's permissions.

    <p>False</p> Signup and view all the answers

    What command is used to add the Sticky Bit to a directory?

    <p>chmod o+t directory_name</p> Signup and view all the answers

    PAM stands for __________.

    <p>Pluggable Authentication Modules</p> Signup and view all the answers

    Match the PAM module with its purpose:

    <p>pam_unix.so = Handles traditional password-based authentication pam_ldap.so = Authenticates users against an LDAP directory pam_tally2.so = Tracks failed login attempts and locks accounts pam_cracklib.so = Enforces password strength rules</p> Signup and view all the answers

    Which type of PAM module is responsible for checking if a user's account is valid?

    <p>account</p> Signup and view all the answers

    PAM allows only one authentication method to be used per service.

    <p>False</p> Signup and view all the answers

    What is the purpose of the Sticky Bit in a directory?

    <p>Restricts file deletion to the file owner and root</p> Signup and view all the answers

    A configuration file for PAM is typically located in __________.

    <p>/etc/pam.d/</p> Signup and view all the answers

    Match the following PAM types with their descriptions:

    <p>auth = Handles user authentication account = Verifies account validity password = Manages password updates session = Sets up user sessions</p> Signup and view all the answers

    Which of the following is a common module for enforcing password strength?

    <p>pam_cracklib.so</p> Signup and view all the answers

    PAM allows system administrators to define authentication policies for applications in multiple locations.

    <p>False</p> Signup and view all the answers

    What happens when an application requests authentication through PAM?

    <p>PAM processes the request and determines the authentication result based on its configured modules.</p> Signup and view all the answers

    The command to set Setgid on a directory is __________.

    <p>chmod g+s directory_name</p> Signup and view all the answers

    Study Notes

    chmod Special Permissions

    • s in chmod refers to Setuid or Setgid permissions, affecting file/directory access.

    Setuid (Set User ID)

    • Purpose: Allows running an executable with the owner's permissions, temporarily.
    • How it Works: Executes a file as if run by the owner of the file.
    • Example: passwd command—updates passwords with root privileges.
    • Setting Setuid: chmod u+s file (adds to owner)

    Setgid (Set Group ID)

    • Purpose: Allows running an executable with the group's permissions, temporarily. Applies group ownership to newly created files/directories inside.
    • How it Works: Temporarily runs with group permissions. Used for shared directories; ensures created files inherit the same group ownership.
    • Example: Shared team directory where all files belong to the team.
    • Setting Setgid: chmod g+s directory (adds to group)

    Sticky Bit (t)

    • Sticky bit, although not an s, is a special permission frequently used with chmod. On directories, only owner or root can delete/rename files, even if others have write access.

    Examples and Use Cases

    1. Setuid (Binary): Example program requiring temporary root privileges.

      • Owner: root
      • Permissions appear as: -rwsr-xr-x 1 root root 12345 Jan 7 14:00 program
    2. Setgid (Directory): Shared team directory with group ownership inheritance.

      • Permissions appear as: drwxrwsr-x 2 user team 4096 Jan 7 14:00 directory
    3. Sticky Bit with Setgid: Group collaboration with file security in a directory.

    • Permissions appear as: drwxrwsr-t 2 user team 4096 Jan 7 14:00 dir

    Pluggable Authentication Modules (PAM)

    • Purpose: A framework for flexible & centralized user authentication in Unix-like systems.

    Key Features of PAM

    • Pluggable: Uses modular "plugins" (modules) for authentication tasks.
    • Centralized: Defines policies for all applications in one place (config files).
    • Customizable: Services (e.g., SSH, sudo, login), can have unique authentication rules.

    How PAM Works

    1. Application Request: Application requests authentication from PAM.
    2. PAM Processes: PAM consults its config files to determine modules needed.
    3. Results: Modules handle specific tasks, and PAM returns a success/fail result to the application.

    PAM Configuration

    • Location: /etc/pam.d/ (or /etc/pam.conf)
    • Syntax: [type] [control] [module-path] [arguments] describes each module and its behavior—controls, module path, etc.

    PAM Module Types and Examples

    • auth: User authentication.
    • account: Checks account validity.
    • password: Manages password updates.
    • session: Sets up/tears down user sessions.
    • pam_unix.so: Traditional password authentication.
    • pam_ldap.so: LDAP (directory service) authentication.
    • pam_tally2.so: Tracks failed login attempts, locks accounts after failures.
    • pam_cracklib.so: Enforces password strength rules.
    • pam_mkhomedir.so: Automatically creates home directories on initial login.

    PAM Examples in Action

    • SSH Authentication (/etc/pam.d/sshd): Combining modules for flexible authentication.
    • Password Strength: Enforces strong passwords using pam_cracklib.
    • Account Lockout: Locks accounts after repeated login failures using pam_tally2.

    Advantages of PAM

    • Flexible: Customize authentication policies easily.
    • Centralized: Manage authentication across multiple services uniformly.
    • Extensible: Add new authentication methods (e.g, biometric).
    • Interoperable: Integrates with outside systems (e.g., LDAP, Kerberos).

    Conclusion

    • PAM provides centralized & flexible user authentication in Unix-like systems, enhancing security and simplifying system administration.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge on special permissions in Unix using chmod, including Setuid, Setgid, and the Sticky Bit. This quiz will help you understand how these permissions affect file access and group ownership. Perfect for anyone looking to deepen their understanding of Unix permissions.

    Use Quizgecko on...
    Browser
    Browser