SFTP WordPress Lesson

So last night spent hours trying to figure out why WordPress asks for FTP details when I want to load plugins or delete themes.  My searches first took me to WordPress.org where I worked through a large number of posts.  The suggestion that looked like a good one was to force the issue with the following addition to the wp-config.php:

define(‘FS_METHOD’,’direct’);

Initially that made me happy as on the face of it it looked as though it was working.  There was no request for FTP details, and when I attempted to delete a theme, it said it was “successfully” deleted, except the theme was still there.  When I tried to reinstall WordPress it attempted to install and looked as though it was doing something until it was obvious  it wasn’t.  WordPress Codex suggested by way of an alternative that “direct” could be replaced with “ssh2” or “ftpext” or “ftpsockets” in that order, however that didn’t work either.  WP reverted back to asking for FTP details again.

Next I navigated to the VestaPanel Community Forum and soon realized that the problem was unique to VestaPanel users – there were a good number of posts discussing the issue.  I was finally able to grasp that the owner of my WordPress installation was ROOT and not ADMIN and that was the reason WordPress was asking for FTP details.  When I had installed my VestaCP I had made a decision not to install an FTP server and to use SFTP .  Which in essence meant that ROOT and not ADMIN was the owner of my WordPress installation.  WordPress was looking for ROOT and since ADMIN didn’t have user privileges it asked for FTP details.  So found the following commands that I will be trying out tonight when I get home:

cd /home/admin/web/domain.tld/public_html/
chown admin -R *

Cross fingers it will work out.  If it does, then this is an important lesson for those with VestaPanel who elect to use SFTP instead of installing an FTP Server.

Note: It did work!  If one doesn’t install an FTP server and one uses SFTP one in effect installs scripts on public_html as ROOT.  One has to give ADMIN ownership of public_html otherwise it will have issues such as with WordPress.  The WordPress site I created is in perfect shape now.  Have to marvel at the speed of the site, especially when I’m working on it.  Probably a combo of VestaPanel as well as VPS speed.  Am very happy with the outcome!