Score:0

Can't View what inside directory but can view file inside of that directory

gs flag

I have directory and file in it

$HOME/tmp/file.txt

I want to make it so that I can't visualize contents inside of tmp but I can visualize contexts inside file.txt So I make this part

cd $HOME
cd tmp
bash: cd: tmp: Permission denied
ls tmp
ls: cannot open directory 'tmp': Permission denied

Now I can't view what's inside of tmp directory (as I wanted)

But I want to access what inside of file.txt, so when I type cat $HOME/tmp/file.txt it must show me what's inside of file.txt and not something like this: cat: /home/user/tmp/file.txt: Permission denied

Score:0
in flag

You need to understand how directory permissions work.

read(r): Allows listing the names of entries in the directory but not entry metadata or contents.
write(w): Allows adding, removing, or moving entries
execute(x): Allows accessing and modifying the entry contents and metadata. In short the permission to search the directory.

So, an execute(x) only directory permission would be sufficient for your use case and let you achieve what you want. As for cd you need r+x or for ls you need the r permission.

PR0X1M4 avatar
gs flag
Thanks this did what i wanted ```sudo chmod a-r tmp```
soulphoenix avatar
in flag
You don't need sudo as you already own your home directory and all contents in it unless root is the owner of tmp.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.