IIRC he would determine the last two numbers by fiddling with the dial “absentmindedly” while talking to the office occupant, then add them to a list he built up. If he needed access (usually he was asked by somebody while the cabinet’s owner was out of town) he would find the first number simply by trial and error. Sometimes he would go into an office, close the door, read a magazine for a while, open it, read some more, then walk out; this gave the impression to others that it was a difficult task.
At the end of the war the project leader (General Grove) left and his safe was locked. Feynman could not open it so they called a locksmith who opened it almost immediately, revealing that it was still set to the factory default combination.
It’s an interesting read in general, and his locksmith tales in particular.