WordPress.org

Ready to get started?Download WordPress

Forums

Changing File Permissions for Uploads folder (chown and chmod) (10 posts)

  1. pcosmic
    Member
    Posted 2 years ago #

    I am currently unable to upload images through WordPress without having to change the 'Uploads' folder permission to '777'.

    Obviously this is a security risk, so I've just been using FTP to upload images in the meanwhile.

    From reading these forums, I think I need to change ownership of the uploads directory to apache and also change permissions so that apache can read, write and execute there too.

    However, I have no idea how to do this! (from URL at the bottom of this post), it states that I should:

    Log into a terminal as the root user.

    Navigate to the folder just above where your WP is installed. Mine is installed to the root directory (httpdocs), so it was at var/www/vhosts/mydomain.com

    Type chown -R (your the username from earlier) (your wp directory)/ - for me, chown -R apache httpdocs/. This changes the ownership of the directory to apache.

    Navigate to your wp-content folder: httpdocs/wp-content/
    Type chmod -R 766 uploads/. This changes permissions so that apache can read, write, and execute there.


    How do I "Log into a terminal as the root user."
    ????????

    From Googling, I've gathered it has something to do with linux and shell something???? please explain simply, in layman's terms.

    Thanks for your help

    http://wordpress.org/support/topic/media-upload-problem-the-uploaded-file-could-not-be-moved-to-error/page/2?replies=42

  2. If you do not have a dedicated server, you will likely not be able to log in as root. The root user is usually the master user for the entire server.

    Do you have a dedicated server or is it a shared host or VPS?

    If it's shared hosting, you are reliant on server-wide settings and will likely not be able to change this type of thing from your end. You can try contacting your host and ask if they would tweak the server to allow you to not have to set upload folders to 777.

  3. pcosmic
    Member
    Posted 2 years ago #

    The website is hosted on a VPS, would I still be able to/ have to login as root? I'm waiting for a response from a company engineer as they were unable to help via phone.

  4. If you were not given a root password when you got your account, you'll need to ask your host for assistance.

  5. pcosmic
    Member
    Posted 2 years ago #

    ok, I'll need to check if my client if was given a root password.

    I've just found the 'Secure Shell Terminal'

  6. pcosmic
    Member
    Posted 2 years ago #

    ok, I've logged into the SSH Terminal and about to follow these instructions below.

    However, i'd only like to chown & chmod the uploads dir (as mentioned in the last paragraph) how would I modify the instructions below?

    1. Create a phpinfo page, if you don't already have one.
    Scroll down to "apache2handler" and look for "User/Group."
    Remember the name listed for the user. My entry was apache(#)/#, the name was "apache."

    2. Log into a terminal as the root user. Google this step if you need help here.

    3. Navigate to the folder just above where your WP is installed. Mine is installed to the root directory (httpdocs), so it was at var/www/vhosts/mydomain.com

    4. Type chown -R (your the username from earlier) (your wp directory)/ - for me, chown -R apache httpdocs/. This changes the ownership of the directory to apache.

    5. Navigate to your wp-content folder: httpdocs/wp-content/
    Type chmod -R 766 uploads/. This changes permissions so that apache can read, write, and execute there.

    @TypecastFilms - Thanks! - I modified your solution and it worked for me. I didn't want to chown the entire wp dir, so I only chowned & chmoded the uploads dir.

  7. pcosmic
    Member
    Posted 2 years ago #

    I'm also having a problem with step 3 "Navigate to the folder just above where your WP is installed"

    How do i navigate to a folder?

  8. Here are some basic Linux shell commands:

    http://linuxreviews.org/beginner/

    Please be extremely careful when working in the shell as you can cause MAJOR damage.

  9. pcosmic
    Member
    Posted 2 years ago #

    thanks @zoonini, I'm apprehensive about doing this, hope engineer gets back to me soon. Any idea how this problem could have been avoided in the first place?

  10. > Any idea how I this problem could have been avoided in the first place?

    It's the server configuration - you can't usually avoid it, it depends on the server setup.

Topic Closed

This topic has been closed to new replies.

About this Topic