I've done the secure them with ropes to an overhead rail thing. But found that I much prefer the attachments to be setup akin to the adjustment lines on pipe berths. So that on the upper edge of the lee cloth, you have a Stiff, Strong, length of
wood (or better, G10 or Aluminum). And I attach the hardware to this. Generally via a strap which goes all of the way around the "batten" on the upper end. So that the hardware is attached to it in a soft fashion, much like using a Spectra strop for the mainsheet block.
The upper batten/rail, also assists in making the upper edge of the lee cloth more substantial, & in keeping the unit well & evenly tensioned. Unlike what often is the case with soft edged lee cloths.
Plus, it then also serves as an ad hoc grab rail, should an on watch crewmember lose their footing while belowdecks.
Be sure that all of the batten's edges are rounded & or eased. Also, the blocks & hardware can be found for pocket change at any used
gear reseller, Ebay, or swap meet. So it needn't be an expensive system.
If you use two pieces of G10 or
Aluminum, through bolted together, through the upper edge of the lee cloth, then it lays pretty flat underneath of the bunk cushion, up against the side of the
hull, when not in use. Ditto on stowing the hardware & lines in said locale.
And I'm a fan of using snap hooks, or carabiners to attach the adjustment hardware to the overhead hard points. So as to facilitate the ease of stowage of said hardware, when it's not in use.
To me, it's preferential to use a lath as Ann T. Cate suggests, for securing the fabric to the bunk top. Albeit usually an
aluminum one (lath), through bolted to the bunk top, with large backing washers, & acorn nuts (so that there's naught for anything to chafe on inside of the under bunk lockers).
And yes, it sounds like overkill, attachment wise. But I've been out in some storms, during which you'd probably rather be back in the club, watching the blow unfold, while sipping coffee, laced with Bailey's ;-)
Also, if you like the quick adjustable setup, but not the batten, nothing mandates that you use one. Just be sure that the cloth which you use, & the attachment points for the adjusting lines is up for the load.
*The load being; several times the weight of the heaviest crewmember (say 4x+). As at times, the weight of the sleeper (times 2-3g's) may bear on just one of the attachment points on the cloth.
My preference for this kind of setup, is that it makes it Very quick (& easy) to get out of your berth in a hurry, should the need arise. In addition to it allowing for easy tuning of the lee cloth while laying in your bunk. And it's a long proven, common sense design.
Plus, to assist with the "tunable" aspect of the lee cloth (as mentioned above) you can put the padeyes in the overhead, positioned somewhat inboard from the bunk's outer edge, so that the lee cloth snugly cradles the sleeper if you really tighten up it's lines.
Which makes for a very secure way to sleep if it's at all rough. Up to & including the kind of conditions which would normally make you "levitate" up off of your bunk. So this assists in preventing that. Making for better sleep quality.
Plus, there's nothing which says you only have to have one set of padeyes in the overhead. And if you like the look, try using a 2m'ish long piece of slotted toe rail instead of padeyes. As it gives you lots of options for hanging other things from the overhead as well. And it can also be used as an underdeck backing plate for your
jib tracks.
For visual prettyness, if you like, you can tuck such a track in behind a longitudinal
teak rail mounted to the overhead.
FYI, using a mesh type of cloth for all but the edges of the lee cloth is preferable, as it breaths in warm
weather. Which is kind of a necessity anywhere warm.
On it's upper edge(s), as well as the leading & trailing ones, you'll need to stitch (& or glue) a perimeter of standard, heavy weight cloth. For this, in the past, I've just used bits of sail cloth, or scraps of Sunbrella. But anything strong should
work.
PS: Generally it helps to keep better tension on the securing lines, if they're led to attachment points which are a little bit ahead of or behind where they're attached to the lee cloth itself.