userUser permission and first commands

Permissions, Users and File System in Linux

This document summarizes key concepts about how permissions, users and directories work in Linux. It also explains useful commands and how to interpret binary and decimal representations.


Types of Users

In Linux there are 3 main types:

  • User (owner): who created the file

  • Group (group): set of users with shared permissions

  • Others (others): the rest of the world (literally)


How Permissions Work (rwx)

Each file or folder has permissions assigned in three blocks:

-rwxr-xr--
  • r → read

  • w → write

  • x → execute

This example means:

  • The owner can read, write and execute

  • The group can read and execute

  • Others can only read


Octal Notation

Binary
Decimal
Permissions

111

7

rwx

110

6

rw-

101

5

r-x

100

4

r--

011

3

-wx

010

2

-w-

001

1

--x

000

0

---

Examples:


Useful Commands

Groups and Users

Permissions


File System in Linux

Linux has a tree-like hierarchical structure. Key examples:

Directory
Description

/bin

Essential system commands

/etc

Configuration files

/home

User folders

/root

Superuser folder

/tmp

Temporary files

/var

Logs and variable files


What is a Binary File?

A binary is a file that contains code that can be executed directly by the system. It's compiled from source language (like C or C++).

How does binary work in Linux?

  • It's stored in locations like /bin, /usr/bin

  • It executes if it has execution permissions (x)

  • We use chmod to make it executable if it's not


Binary and Decimal System

Linux uses numerical systems to handle permissions.

The binary system is based on powers of 2.

Example:

Binary: 01100111

Equals to:

Each bit position (from right to left) is worth: 1, 2, 4, 8, 16, 32, 64, 128...


What relation does it have with IPs?

An IPv4 address is a sequence of 4 bytes → each byte goes from 0 to 255.

Example:


Recommendations

  • Use chmod, chown and ls -l to experiment with permissions

  • Play around changing permissions on test files (not on system files!)

  • Look at the output of ls -l /home and analyze who has what permissions


Quick Reference Commands

Last updated