How can I prevent other users from seeing the contents of my home directory?

8

1

I have a box with multiple users on it and I want everyone to be able to have full access to their home folders, but not be able to see the contents of /home/ or another user's home folder (I.E. bob has full access to /home/bob but cannot access or even see the contents of /home/john)

Right now users can see other user's home folders but can't modify what's inside.

How do I prevent them from seeing the contents at all?

Charlie

Posted 2010-07-08T05:17:19.750

Reputation: 81

Answers

9

Change the permissions of the Home folder...

You need to modify the Home folder's permissions using either:

  • chmod
  • the 'File Permissions' dialog (Nautilus Only)

for chmod

Open a terminal in the home folder and chmod the permissions

chmod go-rwx [usersHomeFolder]

for the 'File Permissions' dialog

  • right-click the usersHomeFolder
  • select 'properties'
  • under the 'permissions' tab change the owner to your user name if it isn't already set, change the group to none, and change other to none.

See this link for more info.

Evan Plaice

Posted 2010-07-08T05:17:19.750

Reputation: 1 387

Note that the 'File Permissions' dialog method is only applicable to users of Nautilus. In Dolphin or Konqueror (KDE), it's the Permissions tab of the Properties dialog, and in other file managers it could be something completely different. chmod works on all Linux systems though. – David Z – 2010-07-08T07:28:54.283

@David Good point, I kinda realized that when I made the answer but I couldn't give examples of the alternatives since I don't have any experience with them. If you want to elaborate with examples for other file management systems I have changed the answer to Community Wiki for others to improve it. – Evan Plaice – 2010-07-29T03:41:19.493

To fully restrict access use chmod go-rwx. Allowing x (execute) on a directory allows you to access files and sub-directories if you know their name. There are a number of files and sub-directories with well known names. – BillThor – 2010-07-29T04:02:18.477

@BillThor Oops, forgot execute access. AFAIK, execute access allows you to execute scripts by editing a files preferences to make it executable (it has nothing to do with with sub-directories). Either way, it's necessary because application files (like nautilus scripts) are hidden in a user's home folder. – Evan Plaice – 2010-07-29T08:56:25.690

2Execute bit on directories has nothing to do with running scripts, it is executing file access. If you leave the execute bit enabled on a directory, then access to files and sub-directories is enabled. – BillThor – 2010-07-29T14:58:10.597

Link you provide is not available @Evan Plaice – alper – 2018-05-11T14:48:10.820