OSError - Errno 13 Permission denied

后端 未结 7 1248
花落未央
花落未央 2020-12-04 18:09

I am trying to upload image through admin page, but it keeps saying:

[Errno 13] Permission denied: \'/path/to/my/site/media/userfolder/2014/05/26\'
<         


        
相关标签:
7条回答
  • 2020-12-04 18:23

    Probably you are facing problem when a download request is made by the maybe_download function call in base.py file.

    There is a conflict in the permissions of the temporary files and I myself couldn't work out a way to change the permissions, but was able to work around the problem.

    Do the following...

    • Download the four .gz files of the MNIST data set from the link ( http://yann.lecun.com/exdb/mnist/ )
    • Then make a folder names MNIST_data (or your choice in your working directory/ site packages folder in the tensorflow\examples folder).
    • Directly copy paste the files into the folder.
    • Copy the address of the folder (it probably will be ( C:\Python\Python35\Lib\site-packages\tensorflow\examples\tutorials\mnist\MNIST_data ))
    • Change the "\" to "/" as "\" is used for escape characters, to access the folder locations.
    • Lastly, if you are following the tutorials, your call function would be ( mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) ) ; change the "MNIST_data/" parameter to your folder location. As in my case would be ( mnist = input_data.read_data_sets("C:/Python/Python35/Lib/site-packages/tensorflow/examples/tutorials/mnist/MNIST_data", one_hot=True) )

    Then it's all done. Hope it works for you.

    0 讨论(0)
  • 2020-12-04 18:24

    Simply try:

    sudo cp /source /destination
    
    0 讨论(0)
  • 2020-12-04 18:37

    Another option is to ensure the file is not open anywhere else on your machine.

    0 讨论(0)
  • 2020-12-04 18:39

    Just close the file in case it is opened in the background. The error disappears by itself

    0 讨论(0)
  • 2020-12-04 18:40

    You need to change the directory permission so that web server process can change the directory.

    • To change ownership of the directory, use chown:

      chown -R user-id:group-id /path/to/the/directory
      
    • To see which user own the web server process (change httpd accordingly):

      ps aux | grep httpd | grep -v grep
      

      OR

      ps -efl | grep httpd | grep -v grep
      
    0 讨论(0)
  • 2020-12-04 18:41

    supplementing @falsetru's answer : run id in the terminal to get your user_id and group_id

    Go the directory/partition where you are facing the challenge. Open terminal, type id then press enter. This will show you your user_id and group_id

    then type

    chown -R user-id:group-id .

    Replace user-id and group-id

    . at the end indicates current partition / repository

    // chown -R 1001:1001 . (that was my case)

    0 讨论(0)
提交回复
热议问题