Skip to content

Create ar.yml #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions lessons/locales/ar_arabic/access/file-permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# أذونات الملفات

## محتوى الدرس

كما تعلمنا سابقًا، تمتلك الملفات أذونات أو أوضاع ملفات مختلفة. لنلقي نظرة على مثال:

<pre>$ ls -l Desktop/
drwxr-xr-x 2 pete penguins 4096 Dec 1 11:45 .
</pre>

هناك أربعة أجزاء لأذونات الملف. الجزء الأول هو نوع الملف، والذي يُشار إليه بالحرف الأول في الأذونات، في حالتنا بما أننا ننظر إلى دليل يظهر الحرف <b>d</b> لنوع الملف. في أغلب الأحيان ستكون كالتالي <b>-</b> إذا كان ملفًا.

الأجزاء الثلاثة التالية من وضع الملف هي الأذونات الفعلية. يتم تجميع الأذونات في 3 بتات لكل منها. أول 3 بتات هي أذونات المستخدم، ثم أذونات المجموعة، ثم الأذونات الأخرى. لقد أضفت (|) لتسهيل التمييز بينها.

<pre>d | rwx | r-x | r-x </pre>

يمثل كل حرف إذنًا مختلفًا:
<ul>
<li>r: قابل للقراءة</li>
<li>w: قابل للكتابة</li>
<li>x: قابل للتنفيذ (عبارة عن ملف تنفيذي)</li>
<li>-: عد تعيين الإذن</li>
</ul>

لذلك في المثال أعلاه، نرى أن المستخدم pete لديه أذونات القراءة والكتابة والتنفيذ على الملف. بينما تحصل مجموعة "PENGUINS" على أذونات القراءة والتنفيذ. وأخيرًا، يحصل المستخدمون الآخرون (أي شخص آخر) على أذونات القراءة والتنفيذ.

## Exercise

استخدم الأمر ls -l على ملفات متعددة واقرأ أذوناتها للمستخدمين والمجموعات.

## Quiz Question

ما هو بت الإذن المستخدم للملفات القابلة للتنفيذ؟

## Quiz Answer

x
56 changes: 56 additions & 0 deletions lessons/locales/ar_arabic/access/modifying-permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Modifying Permissions

## Lesson Content

Changing permissions can easily be done with the <b>chmod</b> command.

First, pick which permission set you want to change, user, group or other. You can add or remove permissions with a <b>+</b> or <b>-</b>, let's look at some examples.

<b>Adding permission bit on a file</b>
<pre>$ chmod u+x myfile</pre>

The above command reads like this: change permission on myfile by adding executable permission bit on the user set. So now the user has executable permission on this file!

<b>Removing permission bit on a file</b>
<pre>$ chmod u-x myfile</pre>

<b>Adding multiple permission bits on a file</b>
<pre>$ chmod ug+w</pre>

There is another way to change permissions using numerical format. This method allows you to change permissions all at once. Instead of using r, w, or x to represent permissions, you'll use a numerical representation for a single permission set. So no need to specify the group with g or the user with u.

The numerical representations are seen below:

<ul>
<li>4: read permission</li>
<li>2: write permission</li>
<li>1: execute permission</li>
</ul>

Let's look at an example:

<pre>$ chmod 755 myfile</pre>

Can you guess what permissions we are giving this file? Let's break this down, so now 755 covers the permissions for all sets. The first number (7) represents user permissions, the second number (5) represents group permissions and the last 5 represents other permissions.

Wait a minute, 7 and 5 weren't listed above, where are we getting these numbers? Remember we are combining all the permissions into one number now, so you'll have to get some math involved.

7 = 4 + 2 + 1, so 7 is the user permissions and it has read, write and execute permissions

5 = 4 + 1, the group has read and execute permissions

5 = 4 +1, and all other users have read and execute permissions

One thing to note: it's not a great idea to be changing permissions nilly willy, you could potentially expose a sensitive file for everyone to modify, however many times you legitimately want to change permissions, just take precaution when using the chmod command.

## Exercise

Change some basic text file permissions and see the bits changing as you do an ls -l.

## Quiz Question

What number represents the read permission when using numerical format?

## Quiz Answer

4
34 changes: 34 additions & 0 deletions lessons/locales/ar_arabic/access/ownership-permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Ownership Permissions

## Lesson Content

In addition to modifying permissions on files, you can also modify the group and user ownership of the file as well.

<b>Modify user ownership</b>

<pre>$ sudo chown patty myfile</pre>

This command will set the owner of myfile to patty.

<b>Modify group ownership</b>

<pre>$ sudo chgrp whales myfile</pre>

This command will set the group of myfile to whales.

<b>Modify both user and group ownership at the same time</b>
If you add a colon and groupname after the user you can set both the user and group at the same time.

<pre>$ sudo chown patty:whales myfile</pre>

## Exercise

Modify the group and user of some test files. Afterwards take a look at the permissions with ls -l.

## Quiz Question

What command do you use to change user ownership?

## Quiz Answer

chown
41 changes: 41 additions & 0 deletions lessons/locales/ar_arabic/access/process-permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Process Permissions

## Lesson Content

Let's segway into process permissions for a bit, remember how I told you that when you run the passwd command with the SUID permission bit enabled you will run the program as root? That is true, however does that mean since you are temporarily root you can modify other user's passwords? Nope fortunately not!

This is because of the many UIDs that Linux implements. There are three UIDS associated with every process:

When you launch a process, it runs with the same permissions as the user or group that ran it, this is known as an <b>effective user ID</b>. This UID is used to grant access rights to a process. So naturally if Bob ran the touch command, the process would run as him and any files he created would be under his ownership.

There is another UID, called the <b>real user ID</b> this is the ID of the user that launched the process. These are used to track down who the user who launched the process is.

One last UID is the <b>saved user ID</b>, this allows a process to switch between the effective UID and real UID, vice versa. This is useful because we don't want our process to run with elevated privileges all the time, it's just good practice to use special privileges at specific times.

Now let's piece these all together by looking at the passwd command once more.

When running the passwd command, your effective UID is your user ID, let's say its 500 for now. Oh but wait, remember the passwd command has the SUID permission enabled. So when you run it, your effective UID is now 0 (0 is the UID of root). Now this program can access files as root.

Let's say you get a little taste of power and you want to modify Sally's password, Sally has a UID of 600. Well you'll be out of luck, fortunately the process also has your real UID in this case 500. It knows that your UID is 500 and therefore you can't modify the password of UID of 600. (This of course is always bypassed if you are a superuser on a machine and can control and change everything).

Since you ran passwd, it will start the process off using your real UID, and it will save the UID of the owner of the file (effective UID), so you can switch between the two. No need to modify all files with root access if it's not required.

Most of the time the real UID and the effective UID are the same, but in such cases as the passwd command they will change.

## Exercise

We haven't discussed processes yet, we can still take a look at this change happening in real time:

<ol>
<li>Open one terminal window, and run the command: <b>watch -n 1 "ps aux | grep passwd"</b>. This will watch for the passwd process.</li>
<li>Open a second terminal window and run: <b>passwd</b></li>
<li>Look at the first terminal window, you'll see a process come up for passwd. The first column in the process table is the effective user ID, lo and behold it's the root user!</li>
</ol>

## Quiz Question

What UID decides what access to grant?

## Quiz Answer

effective
33 changes: 33 additions & 0 deletions lessons/locales/ar_arabic/access/setgid-set-group-id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Setgid

## Lesson Content

Similar to the set user ID permission bit, there is a set group ID (SGID) permission bit. This bit allows a program to run as if it was a member of that group.

Let's look at one example:

<pre>$ ls -l /usr/bin/wall
-rwxr-sr-x 1 root tty 19024 Dec 14 11:45 /usr/bin/wall
</pre>

We can see now that the permission bit is in the group permission set.

<b>Modifying SGID</b>

<pre>$ sudo chmod g+s myfile
$ sudo chmod 2555 myfile
</pre>

The numerical representation for SGID is 2.

## Exercise

No exercises for this lesson.

## Quiz Question

What number represents the SGID?

## Quiz Answer

2
55 changes: 55 additions & 0 deletions lessons/locales/ar_arabic/access/setuid-set-user-id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Setuid

## Lesson Content

There are many cases in which normal users need elevated access to do stuff. The system administrator can't always be there to enter in a root password every time a user needed access to a protected file, so there are special file permission bits to allow this behavior. The Set User ID (SUID) allows a user to run a program as the owner of the program file rather than as themselves.

Let's look at an example:

Let's say I want to change my password, simple right? I just use the passwd command:

<pre>$ passwd</pre>

What is the password command doing? It's modifying a couple of files, but most importantly it's modifying the /etc/shadow file. Let's look at that file for a second:

<pre>$ ls -l /etc/shadow

-rw-r----- 1 root shadow 1134 Dec 1 11:45 /etc/shadow
</pre>

Oh wait a minute here, this file is owned by root? How is it possible that we are able to modify a file owned by root?

Let's look at another permission set, this time of the command we ran:

<pre>$ ls -l /usr/bin/passwd

-rwsr-xr-x 1 root root 47032 Dec 1 11:45 /usr/bin/passwd
</pre>

You'll notice a new permission bit here <b>s</b>. This permission bit is the SUID, when a file has this permission set, it allows the users who launched the program to get the file owner's permission as well as execution permission, in this case root. So essentially while a user is running the password command, they are running as root.

That's why we are able to access a protected file like /etc/shadow when we run the passwd command. Now if you removed that bit, you would see that you will not be able to modify /etc/shadow and therefore change your password.

<b>Modifying SUID</b>

Just like regular permissions there are two ways to modify SUID permissions.

<i>Symbolic way:</i>
<pre>$ sudo chmod u+s myfile</pre>

<i>Numerical way:</i>
<pre> sudo chmod 4755 myfile</pre>

As you can see the SUID is denoted by a 4 and pre-pended to the permission set. You may see the SUID denoted as a capital <b>S</b> this means that it still does the same thing, but it does not have execute permissions.

## Exercise

Look at the permission for /etc/passwd in detail, do you notice anything else? Files with SUID enabled are also easily distinguishable.

## Quiz Question

What number represents the SUID?

## Quiz Answer

4
33 changes: 33 additions & 0 deletions lessons/locales/ar_arabic/access/sticky-bit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# The Sticky Bit

## Lesson Content

One last special permission bit I want to talk about is the sticky bit.

This permission bit, "sticks a file/directory" this means that only the owner or the root user can delete or modify the file. This is very useful for shared directories. Take a look at the example below:

<pre>$ ls -ld /tmp
drwxrwxrwxt 6 root root 4096 Dec 15 11:45 /tmp
</pre>

You'll see a special permission bit at the end here <b>t</b>, this means everyone can add files, write files, modify files in the /tmp directory, but only root can delete the /tmp directory.

<b>Modify sticky bit</b>

<pre>$ sudo chmod +t mydir

$ sudo chmod 1755 mydir</pre>

The numerical representation for the sticky bit is <b>1</b>

## Exercise

What other files and directories do you think have a sticky bit enabled?

## Quiz Question

What symbol represents the sticky bit?

## Quiz Answer

t
29 changes: 29 additions & 0 deletions lessons/locales/ar_arabic/access/umask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Umask

## Lesson Content

Every file that gets created comes with a default set of permissions. If you ever wanted to change that default set of permissions, you can do so with the umask command. This command takes the 3 bit permission set we see in numerical permissions.

Instead of adding these permissions though, umask takes away these permissions.

<pre>$ umask 021</pre>

In the above example, we are stating that we want the default permissions of new files to allow users access to everything, but for groups we want to take away their write permission and for others we want to take away their executable permission. The default umask on most distributions is 022, meaning all user access, but no write access for group and other users.

When you run the umask command it will give that default set of permissions on any new file you make. However, if you want it to persist you'll have to modify your startup file (.profile), but we'll discuss that in a later lesson.

## Exercise

<ol>
<li>Create a new file, then note it's permissions.</li>
<li>Modify the umask and then create another new file.</li>
<li>Check the permissions once more on the new file, what do you expect to see?</li>
<ol>

## Quiz Question

What command is used to change default file permissions?

## Quiz Answer

umask
29 changes: 29 additions & 0 deletions lessons/locales/ar_arabic/booting/boot-process-bios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Boot Process: BIOS

## Lesson Content

<b>BIOS</b>

The first step in the Linux boot process is the BIOS which performs system integrity checks. The BIOS is a firmware that comes most common in IBM PC compatible computers, the dominant type of computers out there today. You've probably used the BIOS firmware to change the boot order of your harddisks, check system time, your machine's mac address, etc. The BIOS's main goal is to find the system bootloader.

So once the BIOS boots up the hard drive, it searches for the boot block to figure out how to boot up the system. Depending on how you partition your disk, it will look to the master boot record (MBR) or GPT. The MBR is located in the first sector of the hard drive, the first 512 bytes. The MBR contains the code to load another program somewhere on the disk, this program in turn actually loads up our bootloader.

Now if you partitioned your disk with GPT, the location of the bootloader changes a bit.

<b>UEFI</b>

There is another way to boot up your system instead of using BIOS and that is with UEFI (stands for "Unified extensible firmware interface"). UEFI was designed to be successor to BIOS, most hardware out there today comes with UEFI firmware built in. Macintosh machines have been using EFI booting for years now and Windows has mostly moved all of their stuff over to UEFI booting. The GPT format was intended for use with EFI. You don't necessarily need EFI if you are booting a GPT disk. The first sector of a GPT disk is reserved for a "protective MBR" to make it possible to boot a BIOS-based machine.

UEFI stores all the information about startup in an .efi file. This file is stored on a special partition called EFI system partition on the hardware. Inside this partition it will contain the bootloader. UEFI comes with many improvements from the traditional BIOS firmware. However, since we are using Linux, the majority of us are using BIOS. So all of these lessons will be going along with that pretense.

## Exercise

Go into your BIOS menu and see if you have UEFI booting enabled.

## Quiz Question

What does the BIOS load?

## Quiz Answer

bootloader
Loading