LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   WordPress cannot get access to my LAMP server. (https://www.linuxquestions.org/questions/linux-newbie-8/wordpress-cannot-get-access-to-my-lamp-server-4175576698/)

Anil Kagi 04-04-2016 10:59 PM

WordPress cannot get access to my LAMP server.
 
1 Attachment(s)
Hello there.

My system specifications: Samsung RV509, i3, 300GB HDD, 3GB Ram, Dual boot Windows7 & LM 17.3 Rosa.

Home server: LAMP

Content management system: WordPress

Domain name: I have not taken a registered domain name yet.

I have successfully installed LAMP & WordPress. I can login to my wordpress dashboard, too with no problems. However the the WordPress cannot access my LAMP server. I cannot Update plugins or Install plugins, upload pictures. I get the following kinds of errors;

Quote:

"Failed to connect to FTP Server localhost:21"

"There was an error connecting to the server, Please verify the settings are correct."

"Unable to create directory wp-content/uploads/2016/04. Is its parent directory writable by the server?"
How I attempted to resolve the issue: What I found from the searches for solution to the issue, was that, this could be an issue about file permissions. However since I am new to both Linux & WP, I do not know how to give file permissions. And I also I didn’t want to make my system insecure. So I have come the forum to get guidance from knowledgeable people, on the forum.

My issue: Due to my ignorance about Linux, LAMP and WP, I am not sure how to fill the connection information being asked by WP, to connect to my home server, viz; Authentication Keys, Public Key, Private Key, Connection Type [FTP, FTPS(SSL), SSH2].

The information being asked is as given in the image below;

Attachment 21380

Please forgive my ignorance, I do not know; How to know, whether I am using a FTP or FTPS or SSH connection? What are Authentication, Public and Private Keys?

Kindly help me to fill this information. And please help me resolve these issues. I would appreciate any suggestions by the compassionate, honourable members of the forum, in this regard.

Thank you

Regards

j-ray 04-05-2016 03:36 AM

First check whether the upload directories exist and are writable
/PATHTO/INSTALLDRECTORY/wp-content/uploads/2016/04

/PATHTO/INSTALLDRECTORY/wpcontent/uploads
is probably existing. Go with bash to this directory ("cd /path/to/WP/wpcontent/") then
chmod 0666 uploads

As WP seems to be looking for an ftp connection is there an FTP server running? If not you can install an FTP server by
sudo apt-get install pure-ftpd

For FTPS and SSH connections you need a running SSH daemon like open-ssh-server
You can install with the same command as above (replace program name)

To install such programs you need root access to the machine.

Hope this helps
j

frankbell 04-05-2016 08:15 PM

Did you configure the file, wp-config.php per instructions (see step three at the link)?

selenaz 04-06-2016 01:34 AM

not acces of lamp
 
i am php developer with nearly 3 yrs of exp. .. i will recommend you to use xampp .. which best and can be use use on any window..

Anil Kagi 04-07-2016 02:41 AM

Thank you j-ray, for coming.

Quote:

Originally Posted by j-ray (Post 5526424)
First check whether the upload directories exist and are writable
/PATHTO/INSTALLDRECTORY/wp-content/uploads/2016/04

/PATHTO/INSTALLDRECTORY/wpcontent/uploads
is probably existing. Go with bash to this directory ("cd /path/to/WP/wpcontent/") then
chmod 0666 uploads

As WP seems to be looking for an ftp connection is there an FTP server running? If not you can install an FTP server by
sudo apt-get install pure-ftpd

For FTPS and SSH connections you need a running SSH daemon like open-ssh-server
You can install with the same command as above (replace program name)

To install such programs you need root access to the machine.

Hope this helps
j

During the installation of WP, I had created a folder, 'uploads' in /var/www/html/wp-content/uploads/. I had not created '2016/04' directory. I did it now after your suggestion. I did it as follows. I opened the 'wp-content' folder as root. And opened it in the terminal by right clicking in it and giving the 'mkdir' command.

Now I have the '/var/www/html/wp-content/uploads/2016/04' directory created. And then I went to the 'wp-content' folder by right clicking on it and opening it in terminal. And then I gave the command 'chmod 0666 uploads' as shown below;

Quote:

wp-content # chmod 0666 uploads
wp-content #
Then I checked in the Synaptic to see if 'pure-ftpd' was installed. I found that it is not installed. So I installed it in the synaptic itself, because it would install any dependencies also, as I have enabled the 'Consider recommended packages as dependencies' option in the synaptic preferences.

I am the root and everything went by fine.

And then I opened the Dashboard of WP, and tried to upload images from my computer. But I again recieved the following error;

Quote:

Unable to create directory wp-content/uploads/2016/04. Is its parent directory writable by the server?
Then I tried to update the WP plugins, I opted for the 'akismet' plugin. A page that requires the 'Connection Information' to be filled in, came up. The following boxes were already filled in by default;

Host name:
FTP/SSH username:
FTP/SSH password:

These above information were all filled in by default. I left it as it is. But below that, some information was left blank as below;

Public Key: ?
Private Key: ?
Connection Type: FTP option was checked by default.

With this much information filled in, I clicked on the proceed button. But then I got the following error;

Quote:

Username/Password incorrect
Then I tried to install a new theme. But again I was asked for the same connection information and got the same error.

Thank you j-ray, for trying to help me.

Regards

Anil Kagi 04-07-2016 02:44 AM

Thank you frankbell, for coming.

Quote:

Originally Posted by frankbell (Post 5526803)
Did you configure the file, wp-config.php per instructions (see step three at the link)?

Yes I have done the configuration. I have created [Copied & renamed 'wp-config-sample.php' file as 'wp-config.php'] and edited the 'wp-config.php' file by changing the default values as below;

Quote:

/** MySQL database username */
define('DB_USER', 'I have changed this to the username I had created while creating the MySQL DB');

/** MySQL database password */
define('DB_PASSWORD', 'I have changed this to the password I had created while creating the MySQL DB');

/** MySQL hostname */
define('DB_HOST', 'localhost');
Thank you frankbell, for the concern.

Regards

Anil Kagi 04-07-2016 02:51 AM

Thanks for coming, selenaz.

Quote:

Originally Posted by selenaz (Post 5526887)
i am php developer with nearly 3 yrs of exp. .. i will recommend you to use xampp .. which best and can be use use on any window..

You mean un-install LAMP and install XAMP?

Thanks for the concern.

Regards

j-ray 04-07-2016 03:00 AM

You have to setup a user for pure-ftpd and use his credentials to connect to the ftp server. By default "root" is not a valid ftp user in pure-ftpd and it is not recommended to use "root" + password of root in ftp.
Actually I would not recommend to use XAMP in a production environment. It is rather an easy-to-use development base.

Anil Kagi 04-08-2016 03:13 AM

Quote:

Originally Posted by j-ray (Post 5527482)
You have to setup a user for pure-ftpd and use his credentials to connect to the ftp server. By default "root" is not a valid ftp user in pure-ftpd and it is not recommended to use "root" + password of root in ftp.
Actually I would not recommend to use XAMP in a production environment. It is rather an easy-to-use development base.

Thanks j-ray, for the valuable information. From what I am beginning assume is this; I am left with two choices. Either give the server direct control over the directory 'wp-content' by changing folder permissions. Or, create a FTP user and make the server that user, by handing over the username and password of that FTP user account. Am I right?

So now I will have to setup a user for pure-ftpd.

I searched the web for 'how to setup a user for pure-ftpd?'. And I found this link. https://help.ubuntu.com/community/PureFTP. But I have some doubts regarding the suggestions in that link. They are as below;

Should I do exactly as suggested there except changing the username?
In the second section headed 'Security', it is stated that;

Quote:

FTP is by nature a rather unsecure protocol. Add TLS support to prevent your sessions from being vulnerable to man-in-the-middle-attacks
So do I have to carry out those steps too to make a secure connection?

PLease kindly suggest what I should do.

Thank you

Regards

j-ray 04-08-2016 05:24 AM

I would suggest to look who owns the wp-content directory and setup this user for pure-ftpd. So check
ls -ls /path/tp/wp-content

That will give out permissions and owner:group

Of course FTP is not a secure protocol. But if you want to use secure protocols you need certifcates and inform yourself about that topic. It is not trivial.

But maybe someone else knows better?

Cheers,
j

Anil Kagi 04-08-2016 10:28 AM

1 Attachment(s)
Quote:

Originally Posted by j-ray (Post 5528084)
I would suggest to look who owns the wp-content directory and setup this user for pure-ftpd. So check
ls -ls /path/tp/wp-content

That will give out permissions and owner:group

Of course FTP is not a secure protocol. But if you want to use secure protocols you need certifcates and inform yourself about that topic. It is not trivial.

But maybe someone else knows better?

Cheers,
j

Thanks for being there, j-ray.

The permissions and owner:group for wp-content are as below;

Attachment 21413

The above shows that root is the owner but in your last post you said;

Quote:

Originally Posted by j-ray (Post 5527482)
....... it is not recommended to use "root" + password of root in ftp.....

Now we find that root is the owner of wp-content and we cannot use "root" + password of root in ftp.

So what is the next alternative course of action, that we need to take?

Is it better to go ahead and create a pure-ftp user?

Thank you

Regards

j-ray 04-08-2016 12:25 PM

ak is the owner not root

Anil Kagi 04-09-2016 12:11 AM

Quote:

Originally Posted by j-ray (Post 5528224)
ak is the owner not root

j-ray,

ak is also the root. Now can I setup this user for pure-ftpd? If yes, how to setup this user for pure-ftpd?

Thanks for staying with me.

Regards

j-ray 04-09-2016 08:58 AM

ak is ak and root is root
if ak has a home directory /home/ak
then you probably can use ak's credentials to connect via ftp to this home directory. So probably you have to configure his access to go to wp-content by default.

Anil Kagi 04-09-2016 10:04 PM

Quote:

Originally Posted by j-ray (Post 5528545)
ak is ak and root is root
if ak has a home directory /home/ak
then you probably can use ak's credentials to connect via ftp to this home directory. So probably you have to configure his access to go to wp-content by default.

Yes j-ray; ak has a home directory /home/ak.

Then how do I configure his access to go to wp-content by default?

Thanks for being there, j-ray. I greatly appreciate your efforts to help me.

Regards


All times are GMT -5. The time now is 04:05 AM.