You have many WordPress installations in a single folder. You want SFTP access to their parent folder, for easy
wp-content replacement or anything else.
You might have come across the DO article on ‘How to Enable SFTP without Shell Access‘, and wondering how you could adapt the setup for your own. Here we go.
Let’s proceed with these assumptions:
- You have all your wordpress installations in the folder,
- In there, you have
In summary, here are the key points of what you would want to do:
- The folder,
/var/wwwmust be owned by root.
- The folder,
/var/www/wordpressmust be owned by
www-data, because that’s what’s used for our WordPress installations, for easy access by Nginx
- We therefore set a file permission
/var/wwwfolder, which is saying, only
rootwould have read, write and execute access, but any other user would be able to read and execute.
- Then add the
- Last but not least, configure your
Now, the steps in detail.
Who Owns What
/var/www is created by default on any Nginx installed system.
We simply need to create our
wordpress/ folder assuming they don’t exist and put our WordPress installations in there.
sudo mkdir -p /var/www/wordpress/website1
We change the
/var/www/wordpress folder to be owned by
sudo chown -R www-data:www-data /var/www/wordpress
Let’s therefore set the file permission on the
/var/www assuming now already done
sudo chmod 755 /var/www
Next, let’s add our
user to the
sudo usermod -a -G www-data user
SFTPness it All
Match User user
To test if our setup is working fine, simply try to log into the
user like so via
user@server:~$ ssh user@localhost
This service allows sftp connections only.
Connection to localhost closed.
Should you see the above, then all is fine.
I hope this helps. See you in the next one.