Search code examples
ubuntupermissionswindows-subsystem-for-linuxmountchmod

How to add a permission to a file on ubuntu with wsl?


What I want to do

I am using ubuntu on wsl. /usr/share/tesseract-ocr/4.00/tessdata/chi_sim.traineddata I want to change the permissions of the file, but it didn't work. (I don't know much about permissions and may be missing or incorrect in the question. I would be grateful if you could give me any information that I'm missing.)


What I did

The execution result of cat /usr/share/tesseract-ocr/4.00/tessdata/chi_sim.traineddata is as follows.

cat: /usr/share/tesseract-ocr/4.00/tessdata/chi_sim.traineddata: Permission denied

I want to be able to read the file for the time being.

$ chmod u-r /usr/share/tesseract-ocr/4.00/tessdata/chi_sim.traineddata The execution result is as follows.

chmod: changing permissions of '/usr/share/tesseract-ocr/4.00/tessdata/chi_sim.traineddata': Operation not permitted

Also, the result of -l command is as follows.

---------- 1 root root 44366093 Jan 10 10:05 /usr/share/tesseract-ocr/4.00/tessdata/chi_sim.traineddata
drwxr-xr-x 1 root root 512 Jan 10 10:25 /usr/share/tesseract-ocr/4.00/tessdata
drwxr-xr-x 1 root root 512 Oct 22 12:49 /usr/share/tesseract-ocr/4.00
drwxr-xr-x 1 root root 512 Jan 10 10:25 /usr/share/tesseract-ocr

Do you know something? I would be happy if you could tell me.


Solution

  • I suspect this is a simple case of using sudo.

    The directory /usr and all the directories inside are owned by the root user and belong to the root group (see the string root root in the ls -al command)

    try sudo chmod u-r /usr/share/tesseract-ocr/4.00/tessdata/chi_sim.traineddata