Personally I'd Stay Away from a Rifle
I'd be afraid to use a rifle of any decent caliber due to over-penetration concerns. You don't want to shoot through the perp, the walls and into your neighbor's house.
I have an old Remington-Spartan 12 gauge SxS coach gun with internal hammers, 20" barrels and double triggers for home protection. I keep it right next to the bed at night. It stays barrels down in an open shotgun bag with a #4 shot shell in one barrel and 00 buckshot shell in the other barrel. I have a 6 shell holder attached to the buttstock with 3 rounds of each type of ammo in it.
I have a flashlight taped to the bottom of the barrels close to the forearm in the center of the barrels. If I hear a noise that ain't right in the middle of the night everyone knows to gather in my bedroom or if they can't get there to lay down on the floor don't move and don't make a sound. We also have a safety word so if by chance I walk into a room with the gun and there are more people in the room than are supposed to be there, I know by that word who is supposed to be there and who is not.
The ideal situation of course is that everyone makes it to my room, I close the door, close the gun, take the safety off and call 911 and the cops get there in time to handle the situation. I'm not counting on that though. The only time I turn the flashlight on and shoot is if someone tries to enter that room without the safety word or without identifying themselves as an LEO. I make sure all household members are accounted for before I even think about shooting. I give a loud verbal command to anyone attempting to enter that I am armed and will shoot if you don't leave or identify yourself.
I also tell the 911 operator to warn the responding LEOs that I am the homeowner, I am armed and I will disarm when I see the LEOs and they have identified theirselves.
I keep a key to the house well hidden outside in a locked box that I can unlock remotely even in a power outage. I tell the 911 operator where the key will be and how the LEO can get it so they can come through the front or back door depending on their situation.
My wife and I and all the people that live in or stay in my house more than occassionally have been through an actual drill of this scenario at least a couple of times a month since we have lived in the house.
I see I went a little off topic here but I think a good gun is worthless without a good plan so I offer both. I believe the above plan will work well in case of a ne'er do well attempting unauthorized entry into my house. I think the above shotgun is just the ticket if needed. Two rounds from it center mass should stop most anyone. If not I have 6 more rounds and a nice pistol full of .45ACP 230 grain JHP XTP close by if needed.
Be safe. Don't shoot unless you absolutely have to. If so, shoot to kill but only long enough to stop the threat. Make damn sure you obey every single word that responding LEO says until the situation is in LEO's control. He or she is trying to help you no matter how it may appear at the time.
One last thing I would mention that many will disagree with, I keep all guns in a safe except for the home defense gun. The last thing I need is family members or friends trying to help by having multiple guns in action. Make a plan and stick to it. The only other loaded gun in my house is the .45 pistol and it is in a safe in the same room with me and the shotgun. Also, in the above situation I am the only one handling any guns and my wife is actually the one talking to the 911 operator.
Make a plan, practice it and make sure everyone sticks to it. You'll be scared but safe most of the time. If you have to shoot, by all means shoot but do it as a last resort. Good luck and God Speed.
A little more than my 2 cents. Hope it helps.
Molon Labe,
Joe