I have installed ubuntu with two folders i.e. / and /home with swap area. I have made two users in /home. But User1 can check the data of User2 and hence vice-versa. I wish to restrict one user to see other's data. Please suggest me how to do so. Thanks in advance.

  • 1. do NOT follow ggalaxy's comment. 2. 11.10 is off topic. – Rinzwind Feb 10 '14 at 7:51

get a root-shell:

sudo -i

go to the home directory

cd /home

change permission of the folder you want by:

chmod 750 [USER_FOLDER_NAME]

this will give read/write/exec to owner read/exec for group and no permission for other users

| improve this answer | |

Although the other answer is completely correct, note that this is a call each user can do. When you log in you can see the permissions on your home directory:

$ ls -ld $HOME
rwxr-xr-x 111 rmano rmano 12288 Feb 10 14:13 .

rwx means that the owner can read, write and cross(1) the directory. The members of group rmano can just read and cross. The last triple specify what to do with "others" users. So if you do (as user):

chmod o-rwx $HOME

you will restrict the access to all "other" users. (Don't do that with the group, it's not needed. In a normal installation you are the only member of your group). Now:

$ ls -ld $HOME
rwxr-x--- 111 rmano rmano 12288 Feb 10 14:13 .

This is the same effect of the other answer; but keep clear that even if you change permissions with the root account, the user can still decide to change the permission back to make his/her files visible.

(1) x means execute for files, "cross"for directories.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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