Linux praktikum 1: Difference between revisions
Created page with "Praktikum 1. Работа с разрешениями и атрибутами файлов и каталогов Задача: научиться работать с кома..." |
No edit summary |
||
| (12 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== Working with permissions and attributes of files and directories== |
|||
Praktikum 1. Работа с разрешениями и атрибутами файлов и каталогов |
|||
'''Task: Learn how to work with commands for changing user permissions''' |
|||
Задача: научиться работать с командами изменения прав пользователя |
|||
Create directories Maria and Juku in the /home/user directory |
|||
Add users maria and juku |
|||
Change only the owner's name of the directories according to the names of the directories |
|||
Поменяйте только имя владельца у каталогов в соответствии с именами каталогов |
|||
Check their presence and attributes |
|||
Проверьте их наличие и атрибуты |
|||
[[ |
[[File:Prak1_Picture_1.png]] |
||
Move to /home/user directory |
|||
Создайте в каталоге Juku файл jukufile.txt |
|||
Create a file jukufile.txt in the Juku directory |
|||
Смените пользователя на juku |
|||
Create a file jukufile2.txt in the Juku directory |
|||
Создайте в каталоге Juku файл jukufile2.txt |
|||
Create a file jukufile3.txt in the Juku directory |
|||
Создайте в каталоге Juku файл jukufile3.txt |
|||
Add write permissions for “other” users to jukufile3.txt |
|||
Check their presence and attributes |
|||
Проверьте их наличие и атрибуты |
|||
[[prak1_Picture 2.png]] |
[[File:prak1_Picture 2.png]] |
||
Change the user to maria |
|||
Смените пользователя на maria |
|||
Which files can the user maria delete? |
|||
Какие файлы может удалить пользователь maria? |
|||
Create a directory sticky in the Maria directory |
|||
Создайте в каталоге Maria каталог sticky |
|||
Create a file script.sh in the sticky directory with the following content |
|||
Создайте в каталоге sticky файл script.sh со следующим содержанием |
|||
<pre> |
<pre> |
||
#!/bin/bash |
#!/bin/bash |
||
| Line 40: | Line 41: | ||
</pre> |
</pre> |
||
Add execution permission for all user categories (all) to the file |
|||
Добавьте всем категориям пользователей (all) разрешение на запуск файла |
|||
Check its presence and attributes |
|||
Проверьте его наличие и атрибуты |
|||
[[prak1_Picture 3.png]] |
[[File:prak1_Picture 3.png]] |
||
Run the script file |
|||
[[File:prak1_Picture 4.png]] |
|||
Запустите скрипт |
|||
Remove execution rights (x) from all users for the sticky directory |
|||
[[prak1_Picture 4.png]] |
|||
Go to the Maria directory |
|||
Can you view the contents of the script.sh file and execute it? |
|||
Уберите права у всех пользователей на выполнение (x) у каталога sticky |
|||
Try the following commands as well: |
|||
Перейдите в каталог Maria |
|||
Можете ли вы посмотреть содержимое файла script.sh, а также запускать его? |
|||
Попробуйте также команды: |
|||
<pre> |
<pre> |
||
cd sticky |
cd sticky |
||
| Line 65: | Line 65: | ||
</pre> |
</pre> |
||
Do the programs work correctly? |
|||
Корректно ли работают программы? |
|||
Верните права на выполнение каталога sticky всем категориям пользователей |
|||
Добавьте “Sticky bit” каталогу sticky |
|||
Проверьте атрибуты |
|||
[[prak1_Picture 5.png]] |
|||
Return the execution rights of the sticky directory to all user categories |
|||
Поставьте права доступа 777 и каталогу sticky и файлу script.sh |
|||
Add the “Sticky bit” to the sticky directory |
|||
Проверьте атрибуты |
|||
Check the attributes |
|||
[[prak1_Picture 6.png]] |
|||
[[File:prak1_Picture 5.png]] |
|||
Set access rights 777 to both the sticky directory and the script.sh file |
|||
Смените пользователя на juku |
|||
Check the attributes |
|||
Попробуйте удалить каталог sticky и файл script.sh командой rm -rf sticky, несмотря на то что у них стоят разрешения «всем все разрешено - 777» |
|||
[[File:prak1_Picture 6.png]] |
|||
Создайте в каталоге Juku каталог sgid |
|||
Change the user to juku |
|||
Дайте разрешение на запись в каталог всем категориям пользователей |
|||
Try to delete the sticky directory and the script.sh file with the command rm -rf sticky, despite the fact that they have permissions “everyone is allowed everything - 777” |
|||
Поставьте атрибут «sgid» на каталог sgid |
|||
Create a directory sgid in the Juku directory |
|||
Проверьте атрибут «sgid», что он находится в правильном месте |
|||
Give write permission to the directory for all user categories |
|||
[[prak1_Picture 7.png]] |
|||
Set the “sgid” attribute on the sgid directory |
|||
Check the “sgid” attribute, make sure that it is in the right place |
|||
Смените пользователя на maria |
|||
[[File:prak1_Picture 7.png]] |
|||
Создайте файл в каталоге sgid |
|||
Change the user to Maria |
|||
Какую группу получил созданный файл, почему juku? |
|||
Create a file in the sgid directory |
|||
Смените пользователя на juku |
|||
What group did the created file get, why juku? |
|||
Уберите права на выполнение (x) для группы у каталога sgid |
|||
Change the user to juku |
|||
Что поменялось? |
|||
Remove execution rights (x) for the group from the sgid directory |
|||
[[prak1_Picture 8.png]] |
|||
What has changed? |
|||
[[File:prak1_Picture 8.png]] |
|||
Поставьте разрешение 1777 на каталог sgid |
|||
Set permission 1777 on the sgid directory |
|||
Что поменялось? Добавился ли “Sticky bit”? |
|||
What has changed? Has the “Sticky bit” been added? |
|||
Поменяйте рекурсивно права доступа в каталоге Juku на 644 от имени суперпользователя. |
|||
Recursively change access rights in the Juku directory to 644 as the superuser. |
|||
Запустите команду ls -lR /home/user и покажите преподавателю. |
|||
Run the command ls -lR /home/user and show it to the teacher. |
|||
[[prak1_Picture 9.png]] |
[[File:prak1_Picture 9.png]] |
||
Latest revision as of 14:56, 11 November 2025
Working with permissions and attributes of files and directories
Task: Learn how to work with commands for changing user permissions
Create directories Maria and Juku in the /home/user directory
Add users maria and juku
Change only the owner's name of the directories according to the names of the directories
Check their presence and attributes
Move to /home/user directory
Create a file jukufile.txt in the Juku directory
Create a file jukufile2.txt in the Juku directory
Create a file jukufile3.txt in the Juku directory
Add write permissions for “other” users to jukufile3.txt
Check their presence and attributes
Change the user to maria
Which files can the user maria delete?
Create a directory sticky in the Maria directory
Create a file script.sh in the sticky directory with the following content
#!/bin/bash echo “Hello, World!”
Add execution permission for all user categories (all) to the file
Check its presence and attributes
Run the script file
Remove execution rights (x) from all users for the sticky directory
Go to the Maria directory
Can you view the contents of the script.sh file and execute it?
Try the following commands as well:
cd sticky ls -l sticky
Do the programs work correctly?
Return the execution rights of the sticky directory to all user categories
Add the “Sticky bit” to the sticky directory
Check the attributes
Set access rights 777 to both the sticky directory and the script.sh file
Check the attributes
Change the user to juku
Try to delete the sticky directory and the script.sh file with the command rm -rf sticky, despite the fact that they have permissions “everyone is allowed everything - 777”
Create a directory sgid in the Juku directory
Give write permission to the directory for all user categories
Set the “sgid” attribute on the sgid directory
Check the “sgid” attribute, make sure that it is in the right place
Change the user to Maria
Create a file in the sgid directory
What group did the created file get, why juku?
Change the user to juku
Remove execution rights (x) for the group from the sgid directory
What has changed?
Set permission 1777 on the sgid directory
What has changed? Has the “Sticky bit” been added?
Recursively change access rights in the Juku directory to 644 as the superuser.
Run the command ls -lR /home/user and show it to the teacher.







