I created a fresh LAMP stack droplet. Now I have to provide my co-worker with access to server web directory (/var/www/) via SFTP. How could it be done right way?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
You can simply add a new linux user for him and grant him access to write to /var/www. <br> <br><ul><li>Create a linux user for him: <a href=“https://www.digitalocean.com/community/articles/how-to-add-and-delete-users-on-ubuntu-12-04-and-centos-6”>https://www.digitalocean.com/community/articles/how-to-add-and-delete-users-on-ubuntu-12-04-and-centos-6</a></li> <br><li>Grant him access to write to /var/www. You can do that by adding a new group called e.g. “developers”, adding both your users to it, setting all of the files in /var/www to be owned by the developers groups, and granting it write access:<pre>#create group: <br>groupadd developers <br>#add your users to it <br>usermod -a -G developers username1 <br>usermod -a -G developers username2 <br>#chgrp /var/www to devvelopers <br>chgrp -R developers /var/www <br>#grant its users write access <br>chown -R g+w /var/www</pre></li> <br></ul> <br> <br>Hope that helps!