A security officer was an officer who worked for Starfleet Security, and was, as such, part of a starship or starbase's security department, under the command of a security chief. A complete study of starship security protocols was generally considered a requirement to fully qualify one to serve in the capacity of a Starfleet security officer. (VOY: "Fair Trade")
A security officer's duties include the protection of Starfleet and Federation assets, the prevention and investigation of crimes, and personal protection of Starfleet officers and Federation or foreign dignitaries.
The Rakhari Croden told Constable Odo with fear and hate about the Rakhari security officers who came in his home at night and killed his wives. When Odo and Croden later unlocked Croden's daughter Yareth from a stasis pod on an asteroid in the Chamra Vortex, Yareth looked with fear at Odo until her father explained that the security officer was a good one. (DS9: "Vortex")