Been scouring the interweb for solution to this but all answers refer to either groups, folder owners or_all_users.
In my case, I have my own user ("
kai") and several others who use the machine.
I have a folder "/home/kai/projects.complete" I can edit files via the shell and SFTP into it.
However I now have a requirement to allow a second/third user read-only access to all files within
The users are not currently set up on the machine at all.
The best solution I've found is to set folder permissions to
rwxrwxrrr to allow myself and my own personal group access to read/write/execute items and all other users to read-only. However, I don't want all other users to have access.
Say my example user is
I want to be create the user
jonny with his own password and give him read only access to
He needs read-only access to all files and directories within projects.complete
He also needs to be able to access the box via SSH and use SFTP the same way as I do, ideally with his default directory in SFTP being
/home/kai/projects.complete (nice to have)
I need a bash command or script that will do the following:
a) Add user user with password
b) Grant the user
read-execute in the folder
/home/kai/projects.complete, along with all of its sub-directories and files. If possible, I'd like the shell to default to this folder instead of
/home/jonny/ (but this is just a nice to have)
c) Allow the under SSH and FTP access to download any files within
d) Disallow access to any other folders or files (must only be able to access
/home/kai/projects.complete and its sub-directories & files)
e) When users logs in on to FTP, I'd like the user to automatically be taken to the directory
/home/kai.projects.complete (again, this is the nice to have - they can always navigate manually or set the default path in the FTP client).
Can anyone give me a solution that doesn't involve me completely changing the permissions of groups or all users? There will come a point where other users are added but shouldn't have access to these files.