1

I have been learning Linux from few days, and now I was trying to learn the advanced file permissions like setting UID, GID and sticky bit. At root I have first changed the ownership of directory to Pavan and g1 group, then, done this:

[root@localhost sdcdir]# ll
total 20
drwx------. 2 root  root 16384 Mar 21 21:38 lost+found
drw-r----T. 2 Pavan g1    4096 Mar 22 11:41 testdir
[root@localhost sdcdir]# chmod 4660 testdir/
[root@localhost sdcdir]# ll
total 20
drwx------. 2 root  root 16384 Mar 21 21:38 lost+found
drwSrw----. 2 Pavan g1    4096 Mar 22 11:41 testdir

After logging in as Pavan I am not able to use CD or Ls on that directory, I am getting the following error:

[Pavan@localhost sdcdir]$ ll
total 20
drwx------. 2 root  root 16384 Mar 21 21:38 lost+found
drwSrw----. 2 Pavan g1    4096 Mar 22 11:41 testdir
[Pavan@localhost sdcdir]$ cd testdir/
bash: cd: testdir/: Permission denied
[Pavan@localhost sdcdir]$ 

Could you please guide me where I have gone wrong. Thank you.

surpavan
  • 157
  • 1
  • 8

2 Answers2

1

Directory needs execute permission (x) for you to enter it. Try

chmod 4770 testdir/

instead.

If you want to grant someone access to enter a directory but not to be (easily) browse its contents, you can grant just the execute permission and not give read permission at all:

chmod 4110 testdir/
Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
  • A small question, I tried with 4770 and 5770 for the directory, in both cases, all files owner user name is there own respective, but not taken from directory owner i.e. Pavan, could you please clarify. – surpavan Mar 22 '12 at 20:12
0

http://en.wikipedia.org/wiki/File_system_permissions

The execute bit... when set for a directory, this permission grants the ability to traverse its tree in order to access files or subdirectories, but not see the content of files inside the directory (unless read is set).

Hence you need "chmod 4770 testdir"

HTH

DerekC
  • 106
  • 5