For the cgi-bin files, set all vars*.cgi files to 777, set all the other cgi files to 755. For the noncgi/Forum, and template, and the cache folders, set them all to 777 (and files within).
In your ubb zip file there's a help folder and inside there's a ubbclassic_test.cgi file you can upload (set to 755) and run from your cgi folder, it will check permissions and other things regarding your forum setup.