How to setup wordpress to use ftps with pem file? - wordpress

On AWS Lightsail/EC2, there is a WordPress instance that is unable to upload images/templates/plugins from within WordPress.
I have been able to FTP into this instance with Filezilla and also ssh with bash. But the upload functionality inside WordPress needs to work.
When trying to install a new theme from within WordPress, it asks for ftps credentials. AWS requires the use of a pem file. The WordPress ui does not have the option of using a pem file.
The solution seems to be something like this, but I don't know the actual commands and steps: SSH in, create a user, give them access to something, create a new pem file, and tell WordPress to use the pem file via the FTP section in the wpconfig file.
The file structure is ~/htdocs/{wordpressFiles}

It sounds like you created the folder via FTP thus the FTP User is the file owner, so Apache cannot access it.
1.) Check if the main user is daemon or bitnami with ls -l
2.) If the user is not daemon you can try sudo chown daemon:daemon path/to/wp-plugins

Related

Can't Open File to Read on Amazon Lightsail

I have an Amazon Lightsail Nginx server installation and am attempting to read from a JSON file on the server.
File permissions are set to 777 and I set my owner to bitnami:daemon but am still unable to read the file. I will need to write to it as well. What are the correct permissions/ownership that needs to be set to read/write files on Lightsail?
The correct permissions required are bitnami:daemon on the web folder as well as any affected children items.

problem on moving Wordpress website from Localhost to Server

I ve created my wordpress website on local, then I hosted it using ovh and filezilla
I followed these steps
upload source files under www fileZilla
import my database on ovh
update wp-config
The problem is when i launch my site it still get css files from localhost nd showing this error
Failed to load resource: net::ERR_CONNECTION_REFUSED
You cannot import a WordPress database and have it just work because there are plenty of hard links (including hostname, in your case localhost) in it.
There are several ways to change the URL in the database. My favorite way is to use wp-cli ( https://wp-cli.org/ ) on the command line. Once installed and having the wp command inside your PATH, you can change (cd) to your WP installation's root directory (where the wp-config.php file is located) and run the following command:
wp search-replace 'http://localhost' 'https://your-new-domain.com' --export=my_wp_export.sql
Replace your-new-domain.com by whatever you're using on your ovh host. Be careful when selecting http or https depending on whether you have a valid SSL certificate in place and your hosting is correctly set up for HTTPS, or not.
You now have an SQL file where each localhost URL is replaced by your-new-domain.com. Next, upload and import the my_wp_export.sql file - everything should work.

Wordpress can't write to file

I've moved my wordpress installation from a managed VPS to a new centos server.
Now I've a problem with writing to files directly from the wordpress admin panel.
Folders/files are set with 755/644. User owner is "wwwuser", group is "apache" (I use this one to access to the documentroot via ftp).
I think that the problem is that in /etc/httpd/conf/http.conf I've user and group setted both to "apache", in fact everything works if I change permissions to 775/664, which should mean that when the group owner is setted to apache everything work, right?
So my question is, should I change all permissions to 775 or there's another solution, which doesn't lead to security issues? Is it safe to make all folders and files 775 and 664? What if I change "apache" to "wwwuser" from /etc/httpd/conf/http.conf?
Edit: is it possible that the problem is that in phpinfo, environment pwd is set to /home/wwwuser/test and not to /home/wwwuser/?
I would advise to not change the user Apache is running under (to not edit the Apache config file) but to set apache as the owner of the files.
chown -R apache /path/to/your/app/files
I think it's the easiest solution. If you choose to change the permissions, you shouldn't have to change the permissions for everyone (other): you could change to 774 but I don't see why 775.
By default Apache is running under the apache user on CentOS.
This is a very common problem you are facing right now. Some times files/directories created/uploaded with FTP may have been assign a different users/usergroup. As #CĂ©line Aussourd stated, if you have installed plugin from WordPress then all files and directories will get the default user/usergroup.
Now easiest way to identify which user should be assigned to your files is create a single test file using CPanel file manager called "test.php" and access it from web if it is working then check its user/usergroup and change all your setup files to that user/usergroup all together with
chown -R {user} /path/to/your/worpress/root
Replace {user} with apache web user.
UPDATE: (To install plugin without FTP details)
Please add following line to your wp-config.php after define('WP_DEBUG', false); line.
define('FS_METHOD', direct);
Remove plugin and re-install it, this time it wont ask you for FTP details and will write files directly.
For me, the solution was to add the mod_suexec apache module

openshift wordpress plugin needs to be granted write access, how do this?

I am trying to install CiviCRM in my openshift wordpress 'gear' And I am getting the following when I attempt to run civicrm's installation wizard:
The user account used by your web-server - 542ddc2950044666c40008d9 -
needs to be granted write access to the following directory in order
to configure the CiviCRM settings file:
//var/lib/openshift/542ddc2950044666c40008d9/app-root/data/plugins/files
Does anyone know if what it is asking is possible?
and then how do I go about setting that?
Thanks!
The plugins/files/civicrm directory is where CiviCRM stores its cached templates, file attachments, premium (thank-you gift) images, and more. It'll need to save stuff there regularly, not just at first.
The best thing to do is to log in through SSH like developercorey recommends and:
cd ~/app-root/plugins
chmod 755 files (changing the permissions so the owner can write and everyone can read/execute)
chown 542ddc2950044666c40008d9:542ddc2950044666c40008d9 files (making the user that the web server runs as ("542ddc2950044666c40008d9" as mentioned in the error message) be the owner of the directory
have the installer check again
SSH into your gear using the rhc ssh command
cd ~/app-root/plugins
ls -lah
Look for the "files" directory and see what the user and the permissions are on that folder, you can change with the "chmod" command to allow it to be written to by the web server, but be careful what you do or you could cause a major headache for yourself (like getting your WP blog hacked). Hopefully the instructions for that plugin include setting the permissions to something reasonable when you are done.

Unable to upload themes to my WordPress installation

I am unable to upload themes to my WordPress installation via WordPress admin. I am getting the following error:
The uploaded file could not be moved to /home/debiprasad/webapps/wordpress/wp-content/uploads/2011/09
The permission of wp-contents directory and all sub directories are: 0755. Some people may suggest to make it 0777. This may work, but I don't think this is the correct solution. Because, all the folders should be have permission 0755 and this is secure. 0755 is the default and it works in other installations.
I want to know what's the reason of this error and what is the perfect and secure solution?
Assuming you use Apache, is your uploads folder owned by www-data? (or whatever user apache/php run as?)
If you have access to change ownership, 0755 should work as long as the upload folder (and subdirectories within) are owned by the same "user" that the web server runs as - so in most cases, that'll be www-data.
If this doesn't work, what method do you use to install themes? ftp, ftps or ssh2?

Resources