Permissions should be 644 and 755 as explained by Shyam.
The problems you are facing are most likely related to the way your server is set up. Most of the time this happens on shared hosts where Apache runs under a different user than your FTP account. Since you usually upload Joomla using FTP, Apache isn't the owner of the file and thus doesn't have the needed permissions to change it.
There is a FTP mode within Joomla which allows you to bypass this problem. You can enable it in the Joomla global configuration. It will then do all file accessing using the FTP user instead of the regular Apache user.
A better way however is to ask your host to fix the issue. They can set up PHP (Apache) to run under a special user, which in such a case should be your FTP user. Then everything will work fine.