A young man on the crew of a spaceship (a luxury passenger liner on a long trip, I believe) ends up as the captain after the ship runs into some kind of danger that kills or disables most or all of the senior officers (and maybe does some damage to the ship, too?). He is either the most senior officer still able to function, or he is the one with some special ability that is needed to be captain. He, after trying to refuse the position, takes charge of the ship, imposes some strict rules on the remaining crew and passengers in order to ensure survival, turns the ship around and returns it to the point of origin, where he is acclaimed by all as a hero. In sequel books, he becomes commandant of the officer cadet academy. He spends A LOT of time angsting about honor and courage, and when the crisis is over and he arrives home, he is disowned by his male relative (father? grandfather?) who raised him because in the course of all his heroic deeds he made a promise to someone and and broke it. Apparently saving the ship was nothing in comparison to that.
If it is useful, I think the danger the ship encounters is in the form of some sort of creature that lives in space, and swarms spacecraft when they find one. I have an impression that these creatures were sort of like jellyfish. The hero of the story is the only one smart enough to figure out that the creatures are attracted by some function of the space ship's drive, and thus is able to safely take the ship home without encountering anymore of these creatures, by avoiding using that particular function--it makes the journey slower, but safer, if I am remembering correctly.
It has some plot similarities to Heinleins's Starman Jones, but this one wasn't intended as a children's book. I thoroughly enjoyed the adventure aspects of the plot, but the main character did cause a "Will you stop whining and get over yourself?" reaction in me.
Either the hero, or the author's last name probably started with F. I googled 'David Feintech' as my best memory of the author's name, but came up blank.