I'm new to shell scripting and am trying to automate the checking of a certain security risk.
I'm trying to test and see if there are any user accounts that haven't been logged in yet. I know I can do this with a script such as
lastlog | grep '**Never logged in**'
However, there are some system users in there that I don't want to consider deleting.
I've read that when a new user is created, the UID (User ID) starts at 500 and increments. I believe I should be able to grab the individual's user ID like this:
cut -f : -d 3 /etc/passwd
However, I'm having some difficulty figuring out how to combine these two methodologies to output only new custom users (versus system users who will never be logged in on my systems).
Since new users on my system will be assigned generic passwords (all of which are going to be the same password), unused user accounts are a security risk on my systems. I'd like to automate the checking process to save myself some time.