I was recently reading about mutinies and I read that captains frequently kept the ship's course and location a secret, so that if anyone tried to mutiny, they wouldn't be able to get back to port.
What, if any, other precautions did captains take to prevent mutinies?
Before I get into answering the question, two things - one, that program we have that uses tracking words to email us that a relevant question may of come up I think only works about 2/3 of the time (it didn't catch it), and I'm surprised this stayed towards the front of the subreddit this long.
Anyway, onto the question. Now, there were no time period or part of the world specifications - so I will go with Atlantic World and 18th century (mostly Anglo-American aspect of that) since that's what I know (and I suspect this question may of originally been targeted towards this).
In the civilian service, there was the issue of mutiny not just for guys looking to go out piracy, but also disputes over the terms of work set down between the crew and their employer. While some of the greater picture aspects might be contentious, Marcus Rediker's book Between the Devil and the Deep Blue Sea does us the service of pointing out these disputes did exist and that crews did try to take their captains and owners to court over breaking agreements over where the ship would sail on a voyage, number of other men that would be on the crew, wages, and so on. But, sometimes to make these issues come to a head and the crew mutinies (it's supposed to be where the term "strike" comes from, as in striking the sails since the crew was no longer following commands of the ship's master and so the ship wasn't going to go anywhere until the issue was resolved). The crew thought that they had the legal right to do so since, supposedly, a contract had been broken. But, there were plenty of opportunities where this mutiny could be interpreted as piracy, so that was a deterrent in itself. Plenty of sailors had sweethearts, wives, and family waiting for them somewhere, so that weighed on plenty of sailors' minds on whether to mutiny. To further deter a mutiny, civilian ships often had ship masters that hired friends, family, and men they generally knew their qualities. If they knew each other and trusted each other more, that would reduce the risk of men going as far as mutiny (since which is easier, going up against people you know and have connections with, or a relative stranger?). Some of the coastal traders of the Atlantic were manned by just a half dozen or less men, and they all probably knew each other for many years. Finally, just to have precautions of the worst case scenario, masters had to have officers he could trust in such an emergency. Also, a ship's master (I should note, for terminology, while the leader of a ship was called captain by his crew, technically he was the ship's master in official terms) could take the precaution of having some weapons in his cabin for defense, or better yet lock up the ship's small arms in his cabin. In the book Boarder's Away by William Gilkerson (in particular the second volume), they have such an arms chest for a civilian vessel pictured. Basically, it was a chest that had a nice wrack set up for 12 muskets, 12 pistols, and 12 cutlasses. The chest was then designed to slip in like a shelf under where the master slept, and the chest could serve as a step down from said bed. So the master pretty much slept above the ship's armament. It should also be noted that civilian masters did have some room to legally discipline his crew with physical punishments as necessary (and of course those occasionally went out of hand - especially if someone dies because of it) - since a strong controlling fist could be seen as a means to quell rebellion (but could also push crews to mutiny out of fear for their lives).
Now, for the British Navy. It helps that a Navy captain often had the help of Royal Marines to act as a police force on ships (roughly the number of marines equaled the number of guns on a ship (as in cannon), so a 70-gun ship would have 70 marines). So, one deterrent was that the captain would have these marines (armed), his officers (armed), and probably a number of loyal men or men who didn't see a mutiny working all on his side. A good captain would make sure his marines and trusted men kept control of the ship's armory so the crew couldn't use them against him. There was also the deterrent of being made into a criminal and being hanged for this action, and the whole issue of "I have family waiting for me at home, if I do this, I may never see them again". The Navy was part of the country's government, so they did have stricter laws against mutiny and were much stricter about punishment of it - since mutiny on a majesty's ship was equatable to treason. The Navy also had more leeway in terms of discipline and punishment compared to civilian vessels, since it was even more crucial for a Navy ship to have discipline (as in not just punishment, but also having a sense of order and a crew that knew to obey orders and to do so instantly) since in battle a lack of discipline could lead to defeat and death. One of the best deterrents to mutiny was to have a captain that demonstrated good leadership, a firm hand, and confidence. If word got out mutiny took place and was successful, other Navy ships would follow to stop the mutineers - making far off stations probably the most vulnerable for mutiny (since, other ships to stop them could be so far away). That's why the Spithead and Nore mutinies stand out in 1797, since it took place in the Channel, during a war, and with large numbers of ship crews at the same time. At that point, it's hard to not listen to the crew demands since trying to bring down this mutiny by force would be costly in the ensuing violence and in the war effort against France (since it would be a significant blow to manpower and probably more struggles with crews in the future). If you want a better idea of what life was like in the Royal Navy at the time, the most current scholarship I could recommend is Royal Tars by Brian Lavery.
Hope that answers your question.