Yes, it is legal to modify it, provided you meet the license requirements. Because a Linux distribution includes many packages, these will be under a number of different license agreements. These agreements will mostly be free licenses, which allow modification and redistribution. Some of the licenses (such as GPL) will require that redistributions use the same license. Many will require that you make the source code available to the people you redistribute to.
You also need to be aware of trademarks. For example, depending on what you intend to do, you may not be able to use the Ubuntu name.
What modifications did you have in mind?
Last edited by neonsignal; 09-29-2010 at 07:27 AM.