Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to fix permissions with the <code>chmod</code> command, like this: <code>chmod 775 /home/shwetanka/logs/mysite/mysite.log</code>.</p> <p>Take a look at the owner of the file with <code>ls -l /home/shwetanka/logs/mysite/mysite.log</code> and make it writable to <code>uwsgi</code>. If the file isn't owned by <code>uwsgi</code>, you'll have to use the <code>chown</code> command.</p> <p>Take a look at the username under which your service is running with <code>ps aux | grep 'uwsgi'</code>.</p> <p>If the security isn't so important to you at the moment, use <code>chmod 777 /home/shwetanka/logs/mysite/mysite.log</code> and that's it. But that's not the way how this is done.</p> <p>The safest way to do this would be to check the owner and the group of the file and then change them if necessary and adjust the permissions accordingly.</p> <p>Let's give an example.</p> <p>If I have a file in <code>/home/shwetanka/logs/mysite/mysite.log</code> and the command <code>ls -l /home/shwetanka/logs/mysite/mysite.log</code> gives the following output:</p> <pre><code>-rw-rw-r-- 1 shwetanka shwetanka 1089 Aug 26 18:15 /home/shwetanka/logs/mysite/mysite.log </code></pre> <p>it means that the owner of the file is <code>shwetanka</code> and the group is also <code>shwetanka</code>. Now let's read the <code>rwx</code> bits. First group is related to the file owner, so <code>rw-</code> means that the file is readable and writable by the owner, readable and writeable by the group and readable by the others. You must make sure that the owner of the file is the service that's trying to write something to it or that the file belongs to group of the service or you'll get a <code>permission denied</code> error.</p> <p>Now if I have a username <code>uwsgi</code> that's used by the USWGI service and want the above file to be writable by that service, I have to change the owner of the file, like this:</p> <p><code>chown uwsgi /home/shwetanka/logs/mysite/mysite.log</code>. Since the write bit for the owner (the first <code>rwx</code> group) is already set to <code>1</code>, that file will now be writable by the UWSGI service. For any further questions, please leave a comment.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload