By Ibrahim Ha
I’ve followed this tutorial to make apache virtual hosts.
What I want is to restrict user access to the domain path [ /var/www/domain.com/public_html ].
e.g: user “none” can only operate on this folder { /var/www/devmuath.com/public_html }
I’m still new on Ubuntu, so please give step by step instructions.
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!
This is a good tutorial on how to do that: https://www.tecmint.com/restrict-sftp-user-home-directories-using-chroot/
Make sure to disable SSH login just like the tutorial shows. Otherwise it’s easy to circumvent the restrictions.
Sorry for being late!
I tried to log in to the server from the user who has the problem and here is the log.
Oct 16 18:42:17 ibrahimh sshd[9947]: Accepted password for root from 2X.X9.18.X0 port 16041 ssh2
Oct 16 18:42:17 ibrahimh sshd[9947]: pam_unix(sshd:session): session opened for user root by (uid=0)
Oct 16 18:42:17 ibrahimh systemd-logind[789]: New session 882 of user root.
Oct 16 18:45:57 ibrahimh sshd[10048]: Accepted password for mouath from 2X.X9.18.X0 port 16394 ssh2
Oct 16 18:45:57 ibrahimh sshd[10048]: pam_unix(sshd:session): session opened for user mouath by (uid=0)
Oct 16 18:45:57 ibrahimh systemd: pam_unix(systemd-user:session): session opened for user mouath by (uid=0)
Oct 16 18:45:57 ibrahimh systemd-logind[789]: New session 883 of user mouath.
Oct 16 18:45:58 ibrahimh sshd[10142]: fatal: bad ownership or modes for chroot directory component "/var/www/"
Oct 16 18:45:58 ibrahimh sshd[10048]: pam_unix(sshd:session): session closed for user mouath
Oct 16 18:45:58 ibrahimh systemd-logind[789]: Removed session 883.
What’s in the error log? Run this right after you attempt a restart of sshd:
journaltctl -xe
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.