How can you prevent other people from tampering with your flight ticket if they somehow get access to your confirmation code? Of course, keeping the confirmation code secret is the most important thing, but I'm just asking just in case someone else got a hold of it and wanted to troll you. (By "troll" I mean that someone does something like cancel my reservation to cause me grief.)
I don't know which locale this applies to, but with regular airlines (as opposed to budget airlines, where ticket changes are nigh impossible), I can certainly change and perhaps even cancel my ticket without requiring to communicate the associated confirmation code. So far, my name and date of travel have been enough to make changes on tickets I've purchased in the past, though sometimes a change incurs a fee.
So, to directly answer your question, you can't, but your question also presumes a certain security related to the confirmation code which isn't there.
Note that I'm not talking about changes through some online system, where typically not the confirmation code, but your login secures access, but simply calling up the airline in question, or visiting one of their offices.
Unfortunately there's not a lot you can do to stop this. Most (but not all) airline websites will allow you to make at least basic changes to a ticket, such as seat changes, using only the confirmation number and name. Some will even let you change flights, or even occasionally cancel the reservation using the same details, although that's less frequent.
On at least a few airline websites I've used (but not most of them) you can only do this if the ticket doesn't have a frequent flyer number assigned to it. If there's an FF number, then you can only make changes if you are logged into the website with the relevant FF details.
Otherwise, about all you can do is try and keep your confirmation number to yourself, and keep an eye on the reservation to make sure that nothing changes.
@Doc is right about keeping your details safe, the two factor authentication is unlikely to be guessed, therefore make sure your email account has a strong unique password and any printed e-tickets are treat with the same respect you would your passport.
Also make sure not to discard your outbound eticket before taking your return flight as they often have your confirmation code and full name, sometimes they also have your passport number and email address. All of which is handy for general identity theft as well as just messing with your flights.