Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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/
share|improve this answer
    
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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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