We just had that problem with Murfee. I took him to the vet and had his anal glands expressed. The vet said they were full and thick

After an immediate bath

he was ok for a couple of days and then started over again so I took him back. His glands were empty but she said that sometimes they still itch so he got an "allergy" shot. That seemed to do the trick. Good luck.