• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Day 4: Permission Please! Understanding File Permissions in RHEL 9

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
Alright Linux padawan, you’ve wandered the file system, created some text-based masterpieces (pizza.txt, anyone?), and deleted files like a keyboard ninja.

But now it’s time for the question that every beginner eventually stumbles across:

"Why won’t Linux let me touch this file?!"

Welcome to the world of file permissions — the part of Linux where the system politely (or sometimes aggressively) tells you:

“You shall not pass.”

Let’s decode the mystery.

? Table of Contents

  • First, Let’s Take a Peek
  • What Those Weird Letters Mean
  • Who Owns This File Anyway?
  • Changing Permissions: Enter the chmod Wizard
  • Changing Ownership: Behold chown
  • Your Mini Permission Mission:
  • Why This Stuff Matters


First, Let’s Take a Peek


Use the mighty ls command with the -l flag to see file permissions in action

You’ll get something like this:


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Looks like a glitch in the Matrix, right? Let’s break it down.


What Those Weird Letters Mean


Take the first 10 characters:
-rw-r--r--

That’s Linux-speak for “who’s allowed to do what.”

  • The first character (-) tells you the file type. A - means a file, a d means directory.
  • The next 9 characters are split into 3 groups of 3:

Group Meaning
rw- Owner (you)
r-- Group (your team)
r-- Others (the world)

Each group uses:

  • r for read
  • w for write
  • x for execute

So rw- means: you can read and write, but not execute.
r-- means: they can only read.
And the last r--? Same deal, but for everyone else.


Who Owns This File Anyway?


Run ls -l shopping_list.txt

You'll see:


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



That second root? That’s the group. The first root is the owner (probably you). Think of it like:

“root owns it. root’s group can peek at it. Everyone else gets to look but not touch.”


Changing Permissions: Enter the chmod Wizard


Want to make a file executable?


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Now it has permission to run. Like, actually do stuff.

Want to remove write permissions from everyone?


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Linux now guards that file like it’s made of gold.

Shortcut magic:

  • u = user (owner)
  • g = group
  • o = others
  • a = all
  • + = add
  • - = remove

So chmod u+x hello.sh means: give the owner execute power.


Changing Ownership: Behold chown


Sometimes you’ll bump into files that don’t belong to you (rude, right?). You might need to take control — if you’re allowed:


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Now Dan is king of the shopping list!


Your Mini Permission Mission:

  1. Create a file called secretdiary.txt
  2. Make it readable only by you
  3. Try to cat it as a different user (if you can)
  4. Add execute permissions
  5. Revoke write permissions for everyone


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



You’re now the bouncer of your own digital nightclub.


Why This Stuff Matters


File permissions aren’t just about control — they’re about security.

In the real world, permissions protect system files, user data, and keep servers from chaos.

If everyone could read, write, and execute everything, it’d be like giving everyone admin rights to your kitchen, bank account, and Netflix password

Learning this now saves you headaches later — and practicing these commands on real files is how it truly sticks.

Up Next (Day 5): Let’s talk about searching your system like a pro, featuring grep, the Sherlock Holmes of Linux

Until then, keep poking at permissions and remember:
If the terminal says “Permission denied,” it’s not personal — it’s just Linux doing its job


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу