Basic implementation of chmod