Password protect wordpress on Bitnami - wordpress

I'm new to Bitnami and currently using a Google Cloud Platform for my VMs.
I'm trying to password protect a wordpress installation for 1 of my VMs. It's a dev site so only going to be using the IP address to access the site.
However following the instructions I found here, I am unable to write in the opt/bitnami/apache2/ folder. Everytime I try to run the commands in the above linked instruction, I get the following error
/opt/bitnami/apache2/bin/htpasswd.bin: cannot create file opt/bitnami/apache2/wordpress_users
I've tried to manually change the permissions on the folder and it doesn't work. I can't seem to run any commands with SU because there is no password provided for shell access (using only a ssh cert file)
Can anyone can offer help as to what I'm doing wrong or what I'm missing?
Thanks

Bitnami developer here,
It is not necessary to modify permission for the apache2 folder nor the htpasswd.bin file. The bitnami user does not have a password by default but is allowed to run commands with higher privileges using sudo. Could you please try to revert the permission changes and run the command with sudo?
cd /opt/bitnami
sudo apache2/bin/htpasswd -cb apache2/wordpress_users your_desired_username your_desired_password
Let me know if you have any other issue or if it worked for you.
Best regards,
Gonzalo

Bitnami developer here,
Sorry I didn't mentioned that you need to change to the /opt/bitnami directory first as I thought you already did it. Also, you have to run command with sudo because root is the owner of the apache2 folder.
Apart from that, I'm glad you could fix your issue!
Best regards,
Gonzalo

Thanks for the idea but it didn't work, I tried with sudo having my apache2/ folder set to 755 and ownership back to it's original setting.
On the other hand.... I manage to solve my problem. Seems that in the original on how to call your command there is a part missing! Well it's missing for me cause by adding the fullpath to the original file I was able to successfully get a password in place and things are now working perfectly
$ opt/bitnami/apache2/bin/htpasswd -cb apache2/wordpress_users username password
Took me too long to get that working... Thanks for the help, without you I wouldn't have made a typo that made me rethink the error! Thanks again

Related

Mamp PRO No Owner / Permission trouble on Windows (Running Wordpress)

I have setup multiple hosts and everything was running fine until I wanted to deploy my website. All files uploaded via wordpress failed to transfer. I found out they had no Owner. So even me as a user/admin couldnt open them. I have to use powershell command "icacls * /reset /t /c /q" to fix the permissions and finally uploaded them but it doesnt sort this problem in a long term. Could anyone help me find out how to change the Owner with which Mamp saves files? Or is there any work around ? I havent been able to find anything in documentation not the interent.

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.

Media won't upload on Wordpress via EC2 instance

I have install Wordpress have it all working on an EC2 instance and RDS.
One small problem I am having is uploading images through the media/image uploader on the wp-admin it keeps saying the following:
'“FC1.jpeg” has failed to upload due to an error
The uploaded file could not be moved to /var/www/html/wp-content/uploads/2012/06.'
I think it's most likely the permissions of the folder, because I used it yesterday and it worked, but after i sort of messed around with the chmod command on ssh.
I know the wp-content folder should be 775 and I have tried that but it doesn't work.
Any help?
Thanks
The permissions you used gave full privileges to the owner so they should work. Check to see who the owner and group are (ls -l on a *nix system).
You will need to know the webserver user and group. Check with your sysadmin (or in /etc/passwd). On *nix systems it is often ww-data or apache.
The owner and group should be set to the webserver. If they are not, run sudo chown webserverUser:webserverGroup.

Wordpress permission problems in Webbynode

I am trying to install (copy) Wordpress files in my Webbynode. I can copy the files. But when I try to upgrade automatically I get a lot of permission errors. I only can solve them using chmod 777 in folders and files, what is not secure.
I'd like to know if someone can explain in simple words who needs to be the owners of the files and folders and/or what is the best way to install wordpress in Webbynode in order to not get these errors.
Thank you.
If you have control over your server, which I understand you have with that provider, you can set the owners of the folders to the same user as the one with which Apache is running, so the permissions could be 755 and the rest of the world won't be able to write into them.
To find out which user Apache is running as you can use:
ps aux | grep apache
Sometimes the process is named "apache2", or also "httpd", instead of "apache".

Resources