By Serkan Ersan
How can I create an SFTP user with restricted access only for /var/www folder.
Thanks
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!
How you’d go about this depends on what you’re comfortable managing. If you simply want users to use SFTP, the setup isn’t too complicated. If you want to physically put users in a chroot, it’s quite a bit more involved and more of a pain to manage / keep up with.
The most basic of ways would be to modify /etc/ssh/ssd_config and add a few setting to allow users to login with SFTP. This will prevent them from modifying other users files, and you can restrict their actual shell (i.e. prevent them from logging in to SSH), but it’s not as airtight as a well-setup chroot.
For example, if you want to go the chroot route, here’s a few links to guide you through the process.
https://olivier.sessink.nl/jailkit/
http://allanfeid.com/content/creating-chroot-jail-ssh-access
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.