0
0
Linux CLIscripting~15 mins

chmod (change permissions) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Learn to Use chmod to Change File Permissions
📖 Scenario: You are managing files on a Linux system. You want to control who can read, write, or execute your files. This is done by changing file permissions using the chmod command.Understanding how to set permissions is important for keeping your files safe and accessible only to the right users.
🎯 Goal: Learn how to use the chmod command to set file permissions for user, group, and others.You will create a file, then change its permissions step-by-step, and finally check the permissions to see the effect.
📋 What You'll Learn
Create a file named example.txt
Use chmod to set permissions
Check permissions using ls -l
Understand symbolic and numeric permission modes
💡 Why This Matters
🌍 Real World
Changing file permissions is essential for protecting files and controlling access on Linux servers and personal computers.
💼 Career
System administrators, developers, and security professionals regularly use <code>chmod</code> to manage file access and secure systems.
Progress0 / 4 steps
1
Create a file named example.txt
Use the touch command to create an empty file called example.txt in your current directory.
Linux CLI
Need a hint?

The touch command creates an empty file if it does not exist.

2
Set read and write permissions for the user only
Use chmod with symbolic mode to give the user read and write permissions on example.txt, and remove all permissions for group and others. Use chmod u=rw,g=,o= example.txt.
Linux CLI
Need a hint?

Symbolic mode lets you set permissions for user (u), group (g), and others (o) separately.

3
Change permissions to allow user read, write, execute; group read and execute; others no permissions
Use chmod with numeric mode to set permissions on example.txt so that the user has read, write, and execute (7), the group has read and execute (5), and others have no permissions (0). Use chmod 750 example.txt.
Linux CLI
Need a hint?

Numeric mode uses digits to represent permissions: 4 for read, 2 for write, 1 for execute. Add them up for each category.

4
Check the permissions of example.txt
Use the ls -l example.txt command to display the permissions of example.txt. This will show the permission string like -rwxr-x---.
Linux CLI
Need a hint?

The output line starts with a dash, then shows user, group, and others permissions in sets of three letters.