I need to verify an /etc/passwd file is valid, and thought regex would be a good idea to verify the lines that are not comments. How would I verify a line like:
root:*:0:0:System Administrator:/var/root:/bin/sh
After some research, the 5th field (System administrator) can contain other data like email and address, the second field could contain anything but a :, the last 2 fields are full paths.
Any clues how I would create a regex expression for this?
Something like this?
(assuming that the username consists of lowercase letters)