Video Summary

Linux File Permissions in 5 Minutes | MUST Know!

Travis Media

Main takeaways
01

Linux permissions use three groups — owner, group, others — each with read (r), write (w) and execute (x) bits.

02

Use ls -l to view permissions; the first character shows file (‑) or directory (d).

03

chown changes file owner and group (sudo chown user[:group] file).

04

chmod sets permissions numerically (r=4, w=2, x=1); combine per group to form codes like 644 or 755.

05

Common baselines: files 644, directories 755; lock sensitive keys to 400.

Key moments
Questions answered

What are the three permission groups in Linux and what do they mean?

Owner: the user who owns the file; Group: users in the file's assigned group; Others: everyone else on the system. Each group has separate r/w/x bits.

How do you view detailed permissions for files and directories?

Run ls -l in the terminal. The output shows file type (d or -) then three sets of rwx permissions for owner, group, and others.

How does the numeric chmod system map to permissions?

Assign values r=4, w=2, x=1 for each group. Sum them per group to form a three-digit code (owner, group, others), e.g., 644 or 755.

What are recommended baseline permissions for files, directories, and sensitive keys?

Files: 644 (owner rw, others r). Directories: 755 (owner rwx, others rx to list/enter). Sensitive key files: 400 (owner read only).

Understanding Linux File Permissions 00:18

"To be a competent Linux user, you need to understand file permissions."

  • Linux file permissions define who can access or modify files and directories on your system.

  • There are three core permission groups: owner, group, and others, each with distinct permissions.

  • Permissions are designated as read (r), write (w), and execute (x), and they determine what each user or group can do with a file or directory.

How to View Permissions in Linux 00:50

"Use the 'ls -l' command to see details about files and directories."

  • The command ls -l displays detailed information, including permissions, about files and directories within a specified path.

  • The first character in the output indicates whether the item is a file (-) or directory (d).

  • Following these characters, you'll find three sets of permissions: owner permissions, group permissions, and permissions for everyone else.

Changing Ownership with Chown 02:50

"The 'chown' command allows you to change the owner of a file or directory."

  • The chown command enables you to assign a different owner or group to a file or directory in Linux.

  • This command syntax involves specifying the new owner followed by the file or directory name.

  • Example: sudo chown Travis myconfig.yaml changes the owner of 'myconfig.yaml' to user 'Travis'.

Modifying Permissions with Chmod 03:45

"The 'chmod' command enables you to change file permissions."

  • The chmod command modifies the permission settings of files or directories using either symbolic or numeric representation.

  • Permissions are represented in a numerical format: read (4), write (2), and execute (1).

  • Common permission settings include 644 for files, allowing the owner read/write permissions while others can only read, and 755 for directories, which permits execution for all users to list contents.

Common Permission Settings 05:03

"A baseline for file permissions should be 644, while directories typically use 755."

  • Standard practices dictate file permissions of 644 allow the owner to read/write, while others have read-only access.

  • For directories, 755 is the norm, enabling the owner full access while allowing others read and execute permissions to navigate the directory.

  • For sensitive files like key pairs, a setting of 400 ensures only the owner can read the file, enhancing security.