I want to know how I can restrict user access using OpenSSH Server. Let's say I want
- user 1 to only access /Media, /Documents, and his home folder,
- User 2 should only access /Folder21, and his homefolder,
- User 3 should only have access to /Documents, /Folder21 and his home folder,
How can I do such a thing?
I found how to do it with one folder, but that was for all users, I think? description here: https://bensmann.no/restrict-sftp-users-to-home-folder/
(copied from link I gave above:
Can I just do this:
$ usermod User1 -s /bin/false $ usermod User2 -s /bin/false
And set the user’s home directory:
$ usermod User1 -d /folder $ usermod User2 -d /folder
then make all the other folders subfolders of /folder, and restrict access to those folders accordingly to my wishes using the
chmod command, or is there a better solution??
Addition and clarification: Adding it to their homedirectory is not an option, as it are shared folders, some users need access to the same content,while it is restricted to other users,
This is what I had in mind:
- user 1
- user 2
- user 3
folder "Network documentation"
- folder "application documentation"
- folder "Downloads"
User 1 needs full access to everything, but Read-only access to application documentation List item
- User 2 needs full access to both documentation folders
- User 3 only needs access to the "Media" folder
- User 4 only needs access to the folder "Downloads" and "Application Documentation"