Score:2

Permission denied to a file in ~/.cache directory

de flag

When I set an output file in the home directory, the following curl command works. But when I use ~/.cache/mydir, it returns "Permission error".

$ ls -al ~/.cache/tera
drwxrwxr-x  2 shinichi shinichi 4096 Jul 28 09:04 .
drwx------ 16 shinichi shinichi 4096 Jul 27 20:52 ..
-rw-rw-r--  1 shinichi shinichi    0 Jul 28 09:04 radio_searches.json


$ curl -X POST -d tag=smooth http://all.api.radio-browser.info/json/stations/search -o $HOME/.cache/tera/radio_searches.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0Warning: Failed to create the file 
Warning: /home/shinichi/.cache/tera/radio_searches.json: Permission denied
100    10    0     0  100    10      0      1  0:00:10  0:00:05  0:00:05     2
curl: (23) Failure writing output to destination

Why I can output to a file in the home directory, but not in the ~/.cache/mydir.

Nmath avatar
ng flag
Please edit your question with the complete command and the complete output.
N0rbert avatar
zw flag
What do you have for `id`, `ls -ald ~/.cache` ?
de flag
id uid=1000(shinichi) gid=1000(shinichi) groups=1000(shinichi),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare) and ls -aid ~/.cache 10616848 /home/shinichi/.cache
pLumo avatar
in flag
What's the output of `lsattr /home/shinichi/.cache/radio_searches.json`?
de flag
$ lsattr /home/shinichi/.cache/tera/radio_searches.json --------------e----- /home/shinichi/.cache/tera/radio_searches.json
Score:2
de flag

I use the Snap when I installed curl.

The Snap ‘home’ interface permits access only to non-hidden files and directories in a user’s /home.

sudo snap remove gh
sudo rm -r ~/snap/gh

I used apt to install curl and it is working now.

sudo apt install curl
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.