Just check if your web user has a write permission to the protected/models directory for creating models… and to the protected/controllers and protected/views for creating CRUD…
A good idea is to remove those permissions when you finish to use Gii…
Since the webserver needs permission to write to the Yii "protected" folder that is most probably owned by you (<user> see: ls -al). Why not do this instead of chmod:
Add your linux <user> to the webserver group.
On default LAMP, webserver group is "www-data". On Zend Server CE the webserver goup is "zend".
On terminal do this:
groups <user>
Will show you the groups you are in. Check for www-data || zend.
sudo usermod -a -G www-data <user> (for standard Apache install)
||
sudo usermod -a -G zend <user> (for Zend Server CE)
so here you are assigning yourself (<user>) to the webserver group.