Praise be to Allah.
There is nothing wrong with working as a security guard for shops and stores that sell permissible things, clothing and otherwise, but it is not permissible to work as a security guard for places that are built for haraam activities, or where the majority of what goes on in them is haraam, such as riba-based banks, bars, gambling venues, dance halls and the like, because of the prohibition on helping others to commit sin.
Allah, may He be exalted, says (interpretation of the meaning):
“And cooperate in righteousness and piety, but do not cooperate in sin and aggression. And fear Allah ; indeed, Allah is severe in penalty”
It says in Fataawa al-Lajnah ad-Daa’imah (14/481): Is it permissible for a Muslim soldier to guard churches, bars, cinemas or entertainment venues such as casinos and places where alcohol is sold?
Answer: It is not permissible to work as a guard protecting churches, bars, and entertainment venues such as cinemas and the like, because that comes under the heading of helping in sin, and Allah, may He be exalted, has forbidden cooperating in sin, as He says (interpretation of the meaning): “And cooperate in righteousness and piety, but do not cooperate in sin and aggression. And fear Allah ; indeed, Allah is severe in penalty” [al-Maa’idah 5:2].
‘Abdullah ibn Ghadyaan, ‘Abd ar-Razzaaq ‘Afeefi, ‘Abd al-‘Azeez ibn ‘Abdillah ibn Baaz. End quote.
Please see the answer to question no. 173073.
If the trader whose store you are guarding mostly deals in permissible things, and you are not directly helping with something that is haraam – such as carrying it or recording it in the ledgers – then there is nothing wrong with you carrying on with this work, based on what is mostly the case.
That is because the presence of some haraam things among the goods sold is a problem that is widespread and difficult to avoid, and the basic principle is that what is secondary may be overlooked and forgiven in a manner that is not applicable in other cases.
And because you mentioned that this work makes it easy for you to pray on time and let your beard grow.
And Allah knows best.