Aaron Swartz on leaving a legacy. The gist is that you should achieve something which, in your absence, would not have happened:
So what jobs do leave a real legacy? It’s hard to think of most of them, since by their very nature they require doing things that other people aren’t trying to do, and thus include the things that people haven’t thought of. But one good source of them is trying to do things that change the system instead of following it. For example, the university system encourages people to become professors who do research in certain areas (and thus many people do this); it discourages people from trying to change the nature of the university itself.