TP 2.2: Find files and control data access
Goal: Find and protect data.
You did some manipulation on files in TP 2.1 and you want to be sure that nobody on the cluster can access your data. Answer the questions to deny access to others.
Search for files¶
Question
From your home directory, search the files named ab*.fasta
with find command.
Display help in order to find the option that search into save
and work
directories that are symbolic links.
Solution
First try:
cd
find . -name "ab*.fasta"
It display nothing, which is not what we expected. Then we check the manual:
man find
Finally, we use the right option:
find -L . -name "ab*.fasta"
Search files by criterion¶
Question
From the directory ~/save/tp_unix
, search files with size greater than 100KB.
Solution
cd ~/save/tp_unix
find . -size +100k
Manage read permissions¶
Question
In the same directory ~/save/tp_unix
, remove the everyone's read permission from the directory data
.
Can you list the content of data
?
Add yourself back the read permission (r
) on this directory.
Solution
chmod a-r data
ls data
chmod u+r data
Manage execution/traversal permissions¶
Question
Remove everyone's execution permission from directory data
.
Could you enter inside the directory data
?
Add yourself back the execution permission (x
) on this directory.
The execussion access on a directory allows traverval of this directory.
Solution
chmod a-x data
cd data
chmod u+x data