Linux praktikum 1: Difference between revisions

From TÜ Narva Kolledži Wiki
Jump to navigation Jump to search
Content deleted Content added
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 13: Line 13:
[[File:Prak1_Picture_1.png]]
[[File:Prak1_Picture_1.png]]


Move to /home/user directory


Create a file jukufile.txt in the Juku directory
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 jukufile2.txt in the Juku directory
Line 25: Line 24:


Check their presence and attributes
Check their presence and attributes



[[File:prak1_Picture 2.png]]
[[File:prak1_Picture 2.png]]



Change the user to maria
Change the user to maria
Line 47: Line 44:


Check its presence and attributes
Check its presence and attributes



[[File:prak1_Picture 3.png]]
[[File:prak1_Picture 3.png]]



Run the script file
Run the script file
Line 77: Line 72:


Check the attributes
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
Set access rights 777 to both the sticky directory and the script.sh file


Check the attributes
Check the attributes



[[File:prak1_Picture 6.png]]
[[File:prak1_Picture 6.png]]



Change the user to juku
Change the user to juku
Line 101: Line 92:


Check the “sgid” attribute, make sure that it is in the right place
Check the “sgid” attribute, make sure that it is in the right place



[[File:prak1_Picture 7.png]]
[[File:prak1_Picture 7.png]]



Change the user to Maria
Change the user to Maria
Line 117: Line 106:


What has changed?
What has changed?



[[File:prak1_Picture 8.png]]
[[File:prak1_Picture 8.png]]



Set permission 1777 on the sgid directory
Set permission 1777 on the sgid directory
Line 129: Line 116:


Run the command ls -lR /home/user and show it to the teacher.
Run the command ls -lR /home/user and show it to the teacher.



[[File: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.