First of all, you should probably consider why this isn't working in the first place. If you don't understand why they are owned as different users there is a good chance that you will be breaking something by attempting to hack around the limitation. It is quite likely that there is a security issue you will be opening yourself up to by doing this.
Additionally, sudo is the right method for a lot of things, but if you are setting it up without a password that is another indication that you are doing something wrong from a security standpoint. Don't assume that because its "your" machine and "you are the only one using it" that you don't need to worry about these things. Especially if you are running a service like and HTTP server, there is a reason the files being served are owned by a different user than you normally use on the system!
All caveats aside, the proper fix for this is to use the normal file system permission levels to give your ubuntu user permission to operate on the files without having to change to another user or escalate to root privilege levels. This is probably easiest done by adding the ubuntu user to the group that owns /www.
# Find out what group owns /www
stat -c %G /www
# Add the ubuntu user to that group
adduser ubuntu <group_that_owns_www>
Now assuming your files have group as well as owner permissions (i.e.
664 or similar for files and
775 for directories) you should be good to go for normal file operations with no special sudo interventions.
Note: After adding a user to a group you have to actually login again in order to for the system to recognize you as part of the new group.