Wordpress upload image error - wordpress

I've built a wordpress website on my mamp localhost, and subsequently uploaded it to a web hosting service.
Since I've uploaded it I cannot upload images via the wordpress 'add media' section. I temporarily change the 'uploads' permissions to 777 and it solved the problem.
I know 777 isn't best practise so I changed it back to 755 and the error has reoccurred.
Is this something to do with the admin user and password I originally set up for wordpress on my localhost versus the ftp user which I created and used to upload the site to the web hosting service?
Does the ftp user own the files - therefore stopping the wordpress admin user from uploading files?
Thanks

Files should be 644, directories should be 755. This is an owner:group permissions issue. Read more in Hardening WordPress.
The real issue is an ownership issue. You're going to need to chown -R username:groupname to your Apache user/group, so that WordPress can write to these directories.

chown -R username:groupname your apache user/group fixed the problem.

Related

FTP permissions on Wordpress Bitnami AWS install?

I have setup a Wordpress site using Bitnami WordPress 4.8.1-0 on AWS (EC2).
I am now migrating a site from Bluehost to the AWS EC2 instance.
I am able to connect to the site via FTP and SSH. I uploaded my plugins and themes with my FTP client, no issues. The site is running with the theme and plugins from the old site. Great.
Now I am trying to upload the media files from /wp-content/uploads/2017/10on the old server but apparently I don't have permission to.
If I do a get-info on the plugins or themes folder, I see it's bitnami:daemon
but Uploads and all its subfolders are daemon:daemon, although it does look like I have write access:
I assume for security, but how can I upload all the media files? I'd hate to have to re-add them all via the admin UI.
You can try accessing via SSH and modify temporarily the permissions:
sudo chown bitnami:daemon -R /opt/bitnami/apps/wordpress/htdocs/wp-content/uploads
Then we advise you to restore the permissions.

Is there a better solution rather than changing wp-content folder persmission to 777 to prevent asking me to put ftp parameters?

I have a running wordpress website and the only issue I have is that each time I want to save an update it's asking me to enter my ftp password.
Is there a better solution to remove this popup without changing wp-content folder permission to 777?
I have run into this issue when the files on my web server are configured with the wrong owner or group.
From the WordPress codex:
Typically, all files should be owned by your user (ftp) account on your web server, and should be writable by that account. On shared hosts, files should never be owned by the webserver process itself (sometimes this is www, or apache, or nobody user).
https://codex.wordpress.org/Changing_File_Permissions
This is something that you will need to resolve on your web server if you know your user and group. Your username is likely the same as your FTP user.
chown -R user:group /path/to/wordpress
If you are on a shared hosting environment you will need to contact your host so that they can fix this problem.
You should also avoid using 777 permissions on your folders. Folders should be 755.

Wordpress permission problems in centOS

I've installed wordpress on Centos (apache) and i was having problems to let wordpress automatically perform certain tasks like updating plugins and making changing to theme files in editor. I studied about permissions in wordpress codex and i made changes to the files permission in my /var/www/html directory. I set all the directories to 0775 and all the files for 0664 but the thing is still not working.
I think that it has something to do with the users. I think that wordpress is not set as the appropriate users to do those tasks. Please tell me what to do.
It sounds like it's an issue with ownership rather than permissions.
Login using SSH.
Run the following command:
sudo chown apache:apache /var/www/html
This changes the ownership of your web root to the web server allowing WordPress to write files (perform automatic updates etc).

No permissions to upload files after installing Wordpress on EC2 - Amazon Tutorial

quite a noob here. Was just able to install a Wordpress following this Amazon tutorial:
Tutorial: Hosting a WordPress Blog with Amazon EC2
The thing is, that I cant upload any images.
Actually the error I get is:
Cant create "Upload" directory. Does the parent directory have persmission?
(not exactly these words as my wp is in portuguese)
I can do everything via FTP (that I installed using this tutorial: The White Way - How to set up WordPress on Amazon EC2).
What I'm trying to learn:
How can I change permissions so that I may upload/create files and folders via Wordpress?
Thanks a lot!
Solution: OK guys what worked for me was: set wp-content and recursively all subfolders and files to permission 777: then I was able to upload. After that I went back to 755 and it continued functioning.
Make sure your wp-content folder has a 755 permission so that wordpress can create an upload directory inside Wp-content folder. You should be able to change the permission of WP-content through FTP.
hmm usually the 755 permission should fix the issue. Maybe check out that folders inside wp-content have also a 755 permission. If this doesn't fix the problem, create a folder called 'uploads' under wp-content and make sure this folder has also a 755 permission.

Wordpress plugins it asks for FTP Details

While I am trying to upgrade the wordpress plugins it Asks for FTP Details.
I have added the following to wp-config.php
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_HOST', 'host address');
It has worked fine.
But I have multiple websites working on my virtualmin server. All the wordpress site is having the same wordpress plugin issue. So is there any other fix that could resolve the Issue?
I just found these: link 1 and link 2, where I dug out this:
WordPress asks for your FTP credentials when it can't access the files directly. This is usually caused by PHP running as the apache user (mod_php or CGI) rather than the user that owns your WordPress files (suPHP or FastCGI). Switching over to using suPHP or FastCGI would probably fix it. Of course, if you don't want to mess with that, you can always just put your FTP credentials directly in wp-config.php or use this in the shell:
pae$ cd /var/ww
pae$ sudo chown -R www-data:www-data wordpress
The best way to deal with wordpress installation on apache is to use the secondary user and group to apache which would not cause these issue while updating or installing plugins and using other wordpress functions.
just change your apache config file User and Group to your username and group name
User [yourusername]
Group [yourgroupname]
In wp-config just write
define('FS_METHOD', 'direct');
Are you hosting your WordPress sites on one of those hosts where WordPress asks you to provide FTP details before upgrading itself or upgrading plugins?
So Now WordPress will stop asking you for FTP details Here’s how you can do it
Open your wp-config.php file locate in your wordpress root directory
And copy and past below detail after your database detail block in wp-config.php file
define(“FTP_HOST”, “ftp.yourhost.com”);
define(“FTP_USER”, “ftpusername”);
define(“FTP_PASS”, “ftppassword”);

Resources