From someone that has major bear issues, the only thing that I have been successful with is baited electric fence. I have had bear climb up on the roof of the garage to get to the hives. I electrified the posts and had them tehn climb up the back of the building and over the roof. Had to electrify around the whole perimeter.
I would highly recommend a quality solar or battery powered charger and baited wire. I have found that AC chargers, at least the cheap feed store one, don't hold up in the long run and get taken out by lightning surges thru the power line.
Here is the portable setup I use when moving my hives. This was taken in the Spring when the hives where still in my yard. It went untouched even though I had 4 bear in my yard and they ripped the door off my chicken coop to get the birds and feed. They also ripped thru my 8 foot garden fence to get to a couple of nucs I had in their. I have a more permanent fenced in area with hives that also went untouched. I bait the wire with hardware cloth smeared with peanut butter.
The problem with rifles is that it is usually too late and the damage is done, and real determined bears will continue to come back and even deal with the pain from buckshot. Anything more than that with a rifle brings on too many headaches.