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 these permissions on a folder.

drwxr-sr-x  2 root    sharedmaster  4096 2010-09-22 10:36 rantest99

I have user tony which is in the group sharedmaster. When I try to mkdir from tony it says permission denied. Why is that?

I have set the gid bit on directory so that new directory has group read write permissions. Where am I wrong.

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

In addition granting write access on the parent directory you almost certainly need to adjust the umask of the user which is probably set to filter away group/other write access.

You probably want to set a umask of 0002.

share|improve this answer
    
thanks buddy i got it –  John Sep 22 '10 at 3:06
add comment

I believe you need to chmod g+w rantest99.

Edit:

chmod g+w dirname makes a directory writable by members of the group. This is what chmod g+s dirname does:

From info coreutils 'Directory Setuid and Setgid'

27.4 Directories and the Set-User-ID and Set-Group-ID Bits ==========================================================

On most systems, if a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. On a few systems, a directory's set-user-ID bit has a similar effect on the ownership of new subfiles and the set-user-ID bits of new subdirectories. These mechanisms let users share files more easily, by lessening the need to use 'chmod' or 'chown' to share new files.

share|improve this answer
    
chmod g+w give write access to group sharedmaster. mkdir need only read access –  bindbn Sep 22 '10 at 2:10
    
I have set chmod g+s on the directory parent to rantest99 and i tested making directory rantest99. But the i was not able to write anything inside the newly cretaed directory . although it has s bit set. what is the diff between g+s and g+w –  John Sep 22 '10 at 2:23
    
@Master, you are also going to need to set/adjust the user's umask. –  Zoredache Sep 22 '10 at 2:29
    
@binbn: mkdir somedir; id -Gn someuser | grep somegroup; sudo chown root:somegroup somedir; sudo -u someuser mkdir somedir/subdir "mkdir: cannot create directory somedir/subdir': Permission denied" sudo chmod g+w somedir; sudo -u someuser mkdir somedir/subdir` success –  Dennis Williamson Sep 22 '10 at 2:40
    
@Master: See my edit. –  Dennis Williamson Sep 22 '10 at 2:47
add comment

paste error please.

test@u1004s02:/tmp$ ls -ald 1
drwxr-sr-x 2 root test 4096 Sep 22 05:49 1
test@u1004s02:/tmp$ id
uid=1001(test) gid=1001(test) groups=1001(test)
test@u1004s02:/tmp$ cd 1  
test@u1004s02:/tmp/1$

About setgid: http://en.wikipedia.org/wiki/Setuid#setuid_and_setgid_on_directories

share|improve this answer
add comment

Your Answer

 
discard

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