Linux praktikum 1: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
== 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 |
|||
Проверьте их наличие и атрибуты |
|||
[[File:Prak1_Picture_1.png]] |
[[File:Prak1_Picture_1.png]] |
||
Создайте в каталоге Juku файл jukufile.txt |
|||
Create a file jukufile.txt in the Juku directory |
|||
Смените пользователя на juku |
|||
Change the user to juku |
|||
Создайте в каталоге Juku файл jukufile2.txt |
|||
Create a file jukufile2.txt in the Juku directory |
|||
Создайте в каталоге Juku файл jukufile3.txt |
|||
Create a file jukufile3.txt in the Juku directory |
|||
Добавьте права на запись пользователям “other” для jukufile3.txt |
|||
Add write permissions for “other” users to jukufile3.txt |
|||
Check their presence and attributes |
|||
Проверьте их наличие и атрибуты |
|||
[[File:prak1_Picture 2.png]] |
[[File:prak1_Picture 2.png]] |
||
Смените пользователя на maria |
|||
Change the user to maria |
|||
Какие файлы может удалить пользователь 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 |
|||
Создайте в каталоге Maria каталог sticky |
|||
Создайте в каталоге sticky файл script.sh со следующим содержанием |
|||
<pre> |
<pre> |
||
#!/bin/bash |
#!/bin/bash |
||
| Line 40: | Line 44: | ||
</pre> |
</pre> |
||
Add execution permission for all user categories (all) to the file |
|||
Добавьте всем категориям пользователей (all) разрешение на запуск файла |
|||
Check its presence and attributes |
|||
Проверьте его наличие и атрибуты |
|||
[[File:prak1_Picture 3.png]] |
[[File:prak1_Picture 3.png]] |
||
Run the script file |
|||
Запустите скрипт |
|||
[[File:prak1_Picture 4.png]] |
[[File:prak1_Picture 4.png]] |
||
Remove execution rights (x) from all users for the sticky directory |
|||
Go to the Maria directory |
|||
Уберите права у всех пользователей на выполнение (x) у каталога sticky |
|||
Can you view the contents of the script.sh file and execute it? |
|||
Перейдите в каталог Maria |
|||
Try the following commands as well: |
|||
Можете ли вы посмотреть содержимое файла script.sh, а также запускать его? |
|||
Попробуйте также команды: |
|||
<pre> |
<pre> |
||
cd sticky |
cd sticky |
||
| Line 65: | Line 70: | ||
</pre> |
</pre> |
||
Do the programs work correctly? |
|||
Корректно ли работают программы? |
|||
Return the execution rights of the sticky directory to all user categories |
|||
Верните права на выполнение каталога sticky всем категориям пользователей |
|||
Add the “Sticky bit” to the sticky directory |
|||
Check the attributes |
|||
Проверьте атрибуты |
|||
[[File:prak1_Picture 5.png]] |
[[File:prak1_Picture 5.png]] |
||
Set access rights 777 to both the sticky directory and the script.sh file |
|||
Check the attributes |
|||
Проверьте атрибуты |
|||
[[File:prak1_Picture 6.png]] |
[[File:prak1_Picture 6.png]] |
||
Change the user to juku |
|||
Смените пользователя на 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 |
|||
Создайте в каталоге Juku каталог sgid |
|||
Give write permission to the directory for all user categories |
|||
Дайте разрешение на запись в каталог всем категориям пользователей |
|||
Set the “sgid” attribute on the sgid directory |
|||
Поставьте атрибут «sgid» на каталог sgid |
|||
Check the “sgid” attribute, make sure that it is in the right place |
|||
Проверьте атрибут «sgid», что он находится в правильном месте |
|||
[[File:prak1_Picture 7.png]] |
[[File:prak1_Picture 7.png]] |
||
Change the user to Maria |
|||
Смените пользователя на maria |
|||
Create a file in the sgid directory |
|||
What group did the created file get, why juku? |
|||
Создайте файл в каталоге sgid |
|||
Change the user to juku |
|||
Какую группу получил созданный файл, почему juku? |
|||
Remove execution rights (x) for the group from the sgid directory |
|||
Смените пользователя на juku |
|||
What has changed? |
|||
Уберите права на выполнение (x) для группы у каталога sgid |
|||
Что поменялось? |
|||
[[File:prak1_Picture 8.png]] |
[[File:prak1_Picture 8.png]] |
||
Set permission 1777 on the sgid directory |
|||
Поставьте разрешение 1777 на каталог sgid |
|||
What has changed? Has the “Sticky bit” been added? |
|||
Recursively change access rights in the Juku directory to 644 as the superuser. |
|||
Поменяйте рекурсивно права доступа в каталоге Juku на 644 от имени суперпользователя. |
|||
Run the command ls -lR /home/user and show it to the teacher. |
|||
Revision as of 17:37, 26 December 2023
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
Create a file jukufile.txt in the Juku directory
Change the user to juku
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.







