Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter prenschler

    (@prenschler)

    @wpranger Many Thanks! I added apache to the www group and rebooted.

    sudo usermod -a -G www apache

    It works now with directories set to 775.

    Thread Starter prenschler

    (@prenschler)

    Ok so I have followed your instructions but it fails. When I do the same thing and set permissions to 777 it works.

    So maybe the webserver is not in the www group?

    I grepped /etc/group for ‘www’:
    grep www /etc/group

    which gave me
    www:x:501:<me>

    I think this is supposed to show me who is a member of the www group. Could 501 or x be the web server?

    If not then I need to figure out what the name of the webserver is so I can add it to the www group.

    If this makes no sense that’s probably because I don’t know what I am talking about.

    Thread Starter prenschler

    (@prenschler)

    Great thank you I am new to web development.

    How do I figure out what the name of the wordpress webserver daemon is so I can add it to the group that owns those folders?

    Below is where I am right now, I need to add the webserver to the www group that owns those folders.

    The file structure looks like this
    /var/www/html/wp-content/uploads

    — START AMAZON INSTRUCTIONS —
    To set file permissions

    Add the www group to your instance.
    [ec2-user ~]$ sudo groupadd www

    Add your user (in this case, ec2-user) to the www group.
    [ec2-user ~]$ sudo usermod -a -G www ec2-user

    Important – You need to log out and log back in to pick up the new group. You can use the exit command, or close the terminal window.

    Log out and then log back in again, and verify your membership in the www group.

    Log out.
    [ec2-user ~]$ exit

    Reconnect to your instance, and then run the following command to verify your membership in the www group.

    [ec2-user ~]$ groups
    ec2-user wheel www

    Change the group ownership of /var/www and its contents to the www group.
    [ec2-user ~]$ sudo chown -R root:www /var/www

    Change the directory permissions of /var/www and its subdirectories to add group write permissions and to set the group ID on future subdirectories.

    [ec2-user ~]$ sudo chmod 2775 /var/www
    [ec2-user ~]$ find /var/www -type d -exec sudo chmod 2775 {} +

    Recursively change the file permissions of /var/www and its subdirectories to add group write permissions.
    [ec2-user ~]$ find /var/www -type f -exec sudo chmod 0664 {} +

    — END AMAZON INSTRUCTIONS —

    Once I get everything working I will change the names for security purposes.

    @ashiado

    I think I have the same problem.

    I updated my upload_path appropriately but then I still got the error. What permissions did you have set for the uploads folder and its subdirectories? When I set permissions to 777 everything worked. I’m not sure if that is a smart solution though.

    I had the same problem.

    Is it safe to set the permissions to 777?

    Thread Starter prenschler

    (@prenschler)

    So I found the ‘upload_path’ field within the wp-options table and it was empty. I’ve since changed the upload path to ‘…/wp-content/uploads’

    To do this I signed into my wordpress mysql database and then called:
    mysql> update wp-options set option_value='.../wp-content/uploads' where option_name='upload_path'

    But this didn’t fix anything – I still got the original error message.

    Then I tried manually creating the directories uploads/2014/01 (since they were not there before) and my error message changed. It now says:

    The uploaded file could not be moved to wp-content/uploads/2014/01.

    After that I tried running:
    find uploads -type d -exec chmod 755 {} \;
    to change the permissions on all of the subdirectories within the uploads folder.

    I still get the same error message.

    However when I set the permissions to 777 I am able to upload files. That is what this stackoverflow thread suggested. I’m not sure if it is a safe solution.

Viewing 6 replies - 1 through 6 (of 6 total)