Skip to main content

How to List all the "Normal Users" in Linux

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

Popular posts from this blog

How to generate a self-signed certificate with Openssl (using git windows bash)

I recently needed to generate a self-signed certificate to test a website locally. I wasn't familiar with the process, and I wanted to share here what I learned. First, we need a private key. A private key is a long series of characters that must be kept secret. In my context, it will be used to encrypt messages before the client and the server, in a way secure enough to prevent anybody to spy on them. Once the private key is created, we need to generate another file that will be the "signature" of our certificate. Among other data, this file will contains some information specific to the server's context: country, organization's name, email address of the organization's technical contact, etc. Once this signature is established, there are two paths: - Path A: If we want our server to be publicly accessible, every browser in the world must able to trust the certificate. In order for that to happen, we need to send our signature file to one of the official SSL ...

Fixing x-invalid-end-tag lint error on Vuejs

  My situation is: Coding with vue in a Vue file. Using the Vetur plugin in VS code It then generates an error of type x-invalid-end-tag in a quite random fashion. To solve it, I have found one simple trick in this github issue: // .eslintrc.js module.exports = {  //... rules:  { 'vue/no-parsing-error': [2, { 'x-invalid-end-tag': false }]  }  }

Installing Postgres on Linux Lite (Ubuntu)

I have followed these instructions from the Postgres documentation : # Create the file repository configuration: sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' # Import the repository signing key: wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - # Update the package lists: sudo apt-get update # Install the latest version of PostgreSQL. # If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql': sudo apt-get -y install postgresql   After that, I was having trouble authenticating to Postgresql after installing the db server on Linux Lite.  This stackoverflow answer was very helpful. Open the file pg_hba.conf . For Ubuntu, use for example /etc/postgresql/13/main$ sudo nano pg_hba.conf and change this line at the bottom of the file, it should be the first line of the settings: local all ...