chmod(), chown() and unlink()

Some fixes. Squash with previous commit.