Here's my situation:
- I have a user storageUser with a home directory of /storage
- storageUser owns /storage with full (RWE) rights
- Within /storage I have a directory media
- I'd like to create a new user mediaUser who's home directory is /storage/media with read-only permissions while maintaining storageUser's full RWE permissions
When using FTP or SSH to sign into the server, I'd like storageUser to be in control of /storage with full RWE permissions, while mediaUser only being able to read /storage/media. I'd like to give access to mediaUser in the future to share my media folder without people being able to make any changes.
Here's what I tried:
- Created mediaUser and set their password
useradd mediaUser
passwd mediaUser
...
- Created a new group storageGroup
groupadd storageGroup
- Added both storageUser and mediaUser to the group
usermod -a -G storageGroup storageUser
usermod -a -G storageGroup mediaUser
- Changed ownership permissions so that storageUser would have permission level 7 (read-write-execute) and storageGroup would have permission level 4 (read-only)
chown -R storageUser:storageGroup media
chmod -R 740 Media
- Changed the home directory of mediaUser
usermod -d /storage/media mediaUser
Permissions for storageUser seem to working OK, but when I SSH into the server as mediaUser, I get this error:
Could not chdir to home directory /storage/media: Permission denied
mediaUser also cannot read directory contents with ls
ls: cannot access '/storage/media': Permission denied
What am I doing wrong?
/home/directory. This is what @shrodingerscat is referring to./storage? And the perms on/storage/medianeed to be750, not740.