I have started to take some challenges on the website called Try Hack Me. I think it's a great way to be more aware of the potential security flaws of my own applications. Plus let's be honest, it's very fun!
Anyway, yesterday I learned how to list the users of a Linux system and understand what kind of account I was looking at. It's pretty cool.
I didn't know, but each user has an ID automatically allocated when they are created. IDs allocated to "normal users" have a min and a max. Those bound can be changed, but I think the default is from 1,000 to 60,000. By "normal users", I mean users created by an admin with the purpose of providing a working access to the machine.
To make sure of those two numbers, you can run:
grep -E '^UID_MIN|^UID_MAX' /etc/login.defs
From there, you just have to list the users by using this command (replace UID_MIN/MAX by the values you just found out).
getent passwd {UID_MIN..UID_MAX}
Tadddaaaa! You just got a list of all the normal users on a machine. I found this commands and more on the website Linuxize, on this page. It was very well explained, check it out if you need more!
Comments
Post a Comment