you thing user2 can access file1).because user2 have the permission to access the file only for file1.but user2 does not have any permission to access dir /home/user1.Then how is it possible user2 access the file1.If user2 have the permission to access the dir
/home/user1 then only he can access the file /home/user1/file1.
you can try it
now.
Testing for the problem.
step1: create the group student and add the user1 and user2 to the group student
[root@localhost ~]# groupadd student
adduser1,2 to group student then
[root@localhost ~]# usermod -G student user1
[root@localhost ~]# usermod -G student user2
step2:now login to the user1
Create the file file1.Then give the full permission
[user1@localhost ~]$ touch file1
[user1@localhost ~]$ chmod 777 file1
[user1@localhost ~]$ ls -l
total 8
-rwxrwxrwx 1 user1 user1 1 Apr 11 00:26 file1
step3:Login to the user2
Access the user1.file1
[user2@localhost ~]$ cat /home/user1/file1
cat: /home/user1/file1: Permission denied
step4: Do you know why user2 can not access user1/file1 with full permission.
Because user2 have the permission only for the file1.but he does not have the permission to access the dir /home/user1
step5:so change the /home/user1 permission to 717
[user1@localhost ~]$ chmod 717 /home/user1
Now user2 can access the user1.file1 file because user2 have the permission to execute folder /home/user1
0 Comments