Can i restrict one user to view other users file and folder in centos and other user unable to view first user files and folder. Means both user's files and folder hidden from each other but superuser/root can view both of them files and folder.

In other words, I'm thinking of having two groups (say NormalUsers1 and NormalUsers2). The NormalUser1 group will have the users user1. And NormalUser2 group will have the users user2. The Superuser group will only have the user root. Now, I need the Superuser to have full access on the files of users in the group NormalUsers1 and NormalUsers2. But both NormalUsers1 and NormalUsers2 cannot access and view each other files and folders.

1 Answer 1


First of all root user have full access to everything in the system, so you don't have to do anything to allow him the see anything.

To prevent users in group NormalUsers1 from seeing files that belong to group NormalUsers2 simply give to those files 0 on the others field

chmod xx0 files 

For more info about file permissions in linux: https://www.linux.com/learn/understanding-linux-file-permissions

  • Sorry i didn't get your second point regarding normal users.
    – blaCkninJa
    Mar 6, 2017 at 12:48
  • This links has more information about file permissions linuxcommand.org/lts0070.php
    – Katu
    Mar 6, 2017 at 13:47
  • 1
    rlinux57, you may want to read up on file permissions. What Mhd Wissam Al-Roujoulah was trying to say was that by breaking up the users into different groups, they wouldn't be able to view each other's files if the permissions were set accordingly. Also reco you read up on umask to see if you went to set a default system umask. Mar 6, 2017 at 22:26
  • I gave 0770 access to folder so that user2 cannot access it, only group1 (user1 and root) can accessed. But user2 is able to view it. Remember I need to hide the file/dir from a SPECIFIC user2/group2.
    – blaCkninJa
    Mar 8, 2017 at 5:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .