I have flown into Munich and taken the train to Salzburg. I have been to Vienna and Budapest (separate trip, took the train from Prague to Vienna and then to Budapest) but not been to Linz. But I'm pretty sure without even looking that there is good train service from Salzburg to Linz, so that's how I would surely do it unless I wanted to stop in between.
In any event, I'm used to trains and prefer them, so the Munich-Salzburg connection was a breeze for me. I think (was a few years ago) I took one of the S-Bahn trains into Munich and picked up the train to Salzburg from there. You'd probably do it the same way now.
I always use Bahn's site (German trains) for reference for trains for all of Europe:
https://www.bahn.com/en/view/index.shtml
The Austrian train site site is here:
https://www.oebb.at/en/index.jsp
Check rental car prices for renting in one country and dropping in another - sometimes a steep one-way drop fee (maybe less so between Germany and Austria, definitely true in other countries). Renting in Linz dropping in Vienna may cost a whole lot less. I will say that while I was glad I took the train to Salzburg (I was headed to Graz and then Slovenia on that trip), I thought the scenery in Bavaria from the train was really beautiful, and I made a mental note that driving through that might be fun someday, with some time to stop at little towns etc. But just to get from A to B, the train is surely the easiest way to go.
You may need an International Driving Permit (IDP) to drive in Germany and/or Austria FYI - not sure, never driven in either country.