How can i restrict a user to their own home directory? [ROOT]

June 21, 2017 1.2k views
Server Optimization Security Linux Basics Ubuntu 16.04

Hi, I am fairly new to linux administration and I've seen some of the posts on how to force users to their own home directory, I've tried several and got locked out of my own server.. I decided it'd be better to make a new post.

Some goals:

  1. I use root to do every other thing (SSH and SFTP mostly)
  2. I'm trying to chroot users to their own directory eg: user test should be restricted to viewing only in home/test/ and cannot view out of it.
  3. SSH access & SFTP access should be allowed for the user test

A Huge thank you in advance.

Be the first one to answer this question.