Added sudo to the permission change function. Need to find a better way to do this.