Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a several users on one machine and its needed to specify which user can access (read & write) specified folders and/or mounted drives.

First of all, one user shouldn't see a home/<%username%>/ of another user.

edit: I'll try to explain very simply: Lets say we have two users: steven and john. Both of them have some private data under their directories: john/private, john/Desktop, steven/private, steven/Desktop. I would like to prevent that steven can access (read or write) under john/ dir and prevent john to read/write under steven/dir.

i'm hope so I'm clear enough :)

share|improve this question
    
Unless you create a virtual machine for each user, there will always be some resources that will show that there are multiple users on the system. For example, even if you were to create a dynamic chroot(1) system, doing a ps would still show that there are other users with their UIDs and GIDs. You might get a better answer if you clarify what you are trying to do. –  Arcege Jun 10 '12 at 22:56
    
mr. @Arcege, I have edited my question, hope it's better now –  dllhell Jun 11 '12 at 10:49
add comment

2 Answers

This is, in general, not possible on Unix. If being able to see the directory but not listing the contents is acceptable (it probably is), then set the mode so that the user affected does not have the read bit set on their modes for that directory (700 or similar).

share|improve this answer
add comment

One solution that I see is to give each user their own group (becoming standard already on various linux boxes) and setting the default umask for the system to 027 (maps to g-w,o-rwx) in /etc/profile or /etc/login.defs (for PAM). Lastly, change the users' "private" directories to 0700 (u=rwx,go=) and their home directory to 0750 (u=rwx,g=rx,o=).

This will still allow your users to control his/her permissions, but the default will prevent other users from seeing the contents.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.