The movie was directed by Billy Wilder, who also adapted the screenplay. While he was working on it, one of the Paramount Studio executives suggested that Wilder change the prison guards from German to Polish, in order to make the film more attractive to the burgeoning West German market. Wilder, whose mother and stepfather had both died in concentration camps, furiously refused to do so. The guards and camp commandant remained German, but the incident hastened Wilder's departure from Paramount. Speaking of camp commandant Colonel von Scherbach, he was played by director extaordinaire Otto Preminger. William Holden, who played J.J. Sefton, won an Academy Award for his performance which is rather ironic because he never wanted the role. He thought the character was too unpleasant and asked for it to be rewritten but this request was refused. He then turned down the part but was forced into it by his studio.
As for bartering with the German guards, well, that was an actual thing that went on, and I can't say that I particularly disapprove, if it's for something which will increase chances of survival such as food, disinfectant, or soap, for example. Sefton though squanders a lot of his accumulated wealth on riotous living, bribing the guards to let him spend time in the Russian women's compound. Such a waste of resources, and an action which which is guaranteed to increase the suspicion the others already harbour about Sefton and his wheeling and dealing.
We also see that Sefton is not above petty resentments and holding grudges when Lieutenant Dunbar arrives and Sefton immediately badmouths him, suggesting that he only received his rank as an officer because his family is wealthy. Whether or not this is true, Dunbar has since proven himself by taking out a Nazi train and its line, something Sefton doesn't even acknowledge because he's fixated on the fact that he was passed over while Dunbar was promoted. He blames Dunbar for this, though it seems likely to me that Sefton's character- that of a loner who places self-interest over that of the troop- was probably not considered officer material. It's also clear that Sefton has no desire to lead the men, so his anger seems to be more bruised ego than anything else. And it's always easier to place the blame for failure on outward forces rather than accepting personal responsibility.
All of this makes it an interesting choice to have Sefton save the day rather than a more stereotypical heroic character. And let's be clear: Sefton hasn't suddenly become a completely reformed character because he's done the right thing and exposed the actual spy. I don't think he suddenly had a 'road to Damascus' moment, though he quite possibly may have, while recuperating from his beating, engaged some introspection as to why his fellow POWs found it so easy to believe that he would betray all of them: he's a massive jerk and everyone (except Cookie) actively dislikes him. But we shouldn't discount his anger at obviously being used by whoever the real traitor is, and his instinct for self preservation: his life is going to be a living hell if the others remain convinced he betrayed them and sent at least two to their deaths, as well as Dunbar. Though, if the men were thinking clearly and not blinded by rage, they would realize that it would be counter productive for an informant to make himself as widely despised and suspected as Sefton has, because people are unlikely to confide in him if they have any choice in the matter. Someone who gives every appearance of being likable, trustworthy and loyal is a much more successful mole. In the end, it is Sefton who figures out who it is because, besides being abrasive and self-serving, he's also smart and observant with a knack for reading people- which is why he's been so successful at fleecing the other men out of their cigarettes, etc. This has made them resent him, but also stands him in good stead in sussing out the real traitor, and working out a plan on the fly for dealing with him and saving Dunbar. The ironic fact is, some of the qualities which make Sefton unsuited to leadership would make him an excellent spy or, if the situation were reversed, mole.
Actually, the humour involving Sgt. Schulz, their barracks guard, takes on a rather sinister aspect as the film goes on. He presents himself as jovial, full of bonhomie, even as he does things- like remove their stove in midwinter as punishment- which cause the men misery. The casual cruelty combined with a pretense of genial goodwill is rather sick-making. And, of course, it is he who is leaving and retrieving messages for and from the informant... evil with a smile is no less evil and frankly, even harder to swallow than evil which doesn't pretend to be anything else.
The film occasionally reminds me of The Great Escape: the tunnel under the stove, the failed escape attempt, the men working together to keep the camp guards from knowing about their plotting. Or perhaps I should say, The Great Escape reminds me of Stalag 17, since it was made first. As I said, the suspense is very well done; we are shown over the course of the film how the informant's messages are being relayed and signaled but are left in the dark as to who it is. It's very obviously not Sefton, just because he is such an obvious suspect. But of course, this leaves us with the unpalatable fact that one of these other characters whom we're getting to know and like is actually a sneaky German spy. And wondering which of these seemingly open and honest guys is actually a betrayer- could it even be Joey, feigning a brain injury? The movie keeps you guessing almost to the end.
To sum up, Stalag 17 is a good movie. It's not my favourite war film by any stretch, but certainly one worth watching and one that will keep you guessing as to just who is the Nazi collaborator.