Search our database

How to Create FTP User for WordPress Only

***Server must have vsFTPd installed for this feature to proceed. You can refer to below article
How to Install and Configure vsFTPd

You can learn how to create user to serve only your WordPress directory. This way, users or administrator will not accidently cause the server to break down if they accidently deleted some system files.

Start by Creating User that will only serve your wordpress root directory (which is /var/www/html)

useradd -d /var/www/html Username-Here

After that, we set password to the new user

passwd Username-Here

Now we have a New User with password created and it will serve /var/www/html as it’s home directory, but we do not have any permission to modify the contents. To understand, type ‘ls -asl’ in your terminal and it should show as below.

User-Permission-1

As per on the screen, we have a drwxr-xr-x which means

(d) – refer to Directory
(rwx) – first set refer to user permission
(r-x) – second set refer to group permission
(r-x) – third set refer to public permission

Now we do not want to mess it up by modifying the owner of the folder or group. What we can do next is to add our new user created into group that have access in for this folder, which is ‘root’ (take note that this is GROUP and not user)

usermod -g root Username-Here

This will add your new user into root’s group.

With that, our new user will have access into /var/www/html folder, but as previously noted, we only have (r-x) permission (which is read and execute) and we need to have a write execute in order to modify the files and folder.

Last step is to modify the folder’s permission. Type command as below in your terminal

chmod -R 775 /var/www/html

Tags: , , , , , , , , ,