I want to create a user that have only access to the following directories and can't see nothing else
/home/vehicles/ #read only
/home/images/ #read only
/home/dump/ #read and write
I used this link https://unix.stackexchange.com/questions/15360/how-to-add-a-ssh-user-who-only-has-permissions-to-access-specific-folder
so that I create a user group called testserver
Match Group testserver
ChrootDirectory %h
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp
and the chmod of those folders like the following
chmod -R 755 /home/vehicles/
chmod -R 755 /home/images/
chmod -R 765 /home/dump/
Everything went good except that testuser is still able to access other folders, how I prevent this user from accessing other folder(i.e only access those three folders)
ChrootDirectory
only works if the target directory is owned by root -- and unless the home directory oftestuser
is/home
itself that'll just lock them into their home directory.