## WeBWorK Main Forum

### permissions on course directories

Number of replies: 3
For reasons having to do with making it easy to administer class lists, I'd like to configure webwork so that when a new course is created (from the web interface) the templates directory has group write permission.

Anyone know how to do this?

thanks, Hal

### Re: permissions on course directories

by Gavin LaRose -
Hi Hal,

I think this will require small modification to the CourseManagement.pm module to implement as you've described it (that is, to have just the templates directory created with write permission given to the group).

I believe that making something like the following changes at about line 220 of CourseManagement.pm (in WeBWorK_Root/lib/WeBWorK/Utils/) will do what you want:

The existing code should look something like
                # try to create it
mkdir $courseDir or warn "Failed to create$courseDirName directory '$courseDir':$!. You will have to create this directory manually.\n";
}

We want to change this so that when it's creating the templates directory it uses a different umask and possibly permissions:
                # try to create it
if ( $courseDir =~ /templates/ ) { my$umaskVal = umask;
mkdir( $courseDir, 0770 ) or warn "Failed to create$courseDirName directory '$courseDir':$!. You will have to create this directory manually.\n";
umask($umaskVal) } else { mkdir$courseDir or warn "Failed to create $courseDirName directory '$courseDir': \$!. You will have to create this directory manually.\n";
}
}


I think that will result in the templates directory being created with a umask 0002 (deny write permission to other) and the rest of the class directories being created with the usual umask for the user the webserver runs as.

To state the perhaps obvious, I haven't tested this.

Cheers,
Gavin

### Re: permissions on course directories

Thanks Gavin,

That worked with an appropriate adjustment to get the permissions I wanted on the templates directory.

I guess I need to make a note to myself to remember this when we do our next CVS update.

-Hal