Report this

What is the reason for this report?

How to create a new SSH user in LAMP stack?

Posted on March 29, 2014

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?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.