In my previous tutorial, I gave an example of how you can install a File manager on Cloudways. If you haven’t read the article yet then check it out here, you are gonna need it before proceeding further as it serves as a prerequisite for this one.
In today’s guide, I am going to share how you can give restricted to the developer or team member.
There are two types of credentials on the Cloudways Platform (Master and Application) that you can use for SFTP/SSH access. Master credentials are the top most powerful credentials on a Cloudways server. It gives you access to all applications within the entire server while Application Credentials gives access to a specific application only in a server. if you wanna see more in-depth details check out the official support article
Well, the feature is great, using the application credentials I can give access of my site to the developer while keeping my master access personal to myself. But what if I don’t wish to give him access to my whole site but instead a specific part of it. for example, I need to resolve an issue with a plugin only the plugin author ask me for (S)FTP logins. Usually, I would create a login on a Cpanel host and share with him. But on Cloudways I don’t have the option I can create an application creadentials but I am concern about my site privacy.
So what’s the solution?
Well, the answer lies in the article I shared as a prerequisite at the start of this post. we are gonna use the Tiny File Manager to give restricted access.
So after setting up the Tiny File manager check out the code in tinyfilemanager.php file where you can set a username and password for your login.
I believe you have already changed the default username and password as suggested earlier. Currently, the user I have for my developer is read access only, the developer can’t modify the code or anything on my site files so there are 2 things I need to do before giving him access.
- I want him to give him write access to my files as well.
- But restrict his access to a specific folder only.
To remove the restrictions of write access, I am going to edit
So first I will adjust the code by removing the user as mentioned below:
$readonly_users = array( );
This will give write access to my user.
Now in order to restrict his directory, I am gonna edit
So if I want to give him access to a plugin directory so I simply define the user and it’s associated directory in the array as shared below
//array('Username' => 'Directory path', 'Username2' => 'Directory path', ...) $directories_users = array( 'admin' => ' /home/master/applications/$appfolder/public_html/', 'user' => '/home/master/applications/$appfolder/public_html/wp-content/plugin/jetpack/' );
With this, you have now learned how to give restricted access to a specific directory on Cloudways.
If you still need more information then check out the official docs here.