• HOME
  • TECH BLOG
  • MIGRATING TO AMAZON WEB SERVICES
  • IT PROJECT MANAGEMENT BLOG
  • Q&A
  • INTERACTIVE LEARNING
Pop-up Preset:








Get a List of All Users using the /etc/passwd File



​



If you want to display only the username you can use:
cut -d: -f1 /etc/passwd



cut -d: -f1 /etc/passwd list all users just by name.



display all usernames with info



cat /etc/passwd displays complete information regarding users.

Each line has seven fields delimited by colons that contain the following information:

1.) User name

2.) Encrypted password (x means that the password is stored in the /etc/shadow file)

3.) User ID number (UID)

4.) User’s group ID number (GID)

5.) Full name of the user(GECOS)

6.) User home directory

7.) Login shell (defaults to /bin/bash)



check whether a user exists



getent passwd bill

checks to see whether or not a user name bill exists.



list all normal users



rep -E '^UID_MIN|^UID_MAX' /etc/login.defs


Normal users are the users created by the root or another user with sudo privileges. Usually, a normal user has a real login shell and a home directory. Each user has a numeric user ID called UID. If not specified when creating a new user with the useradd command, the UID will be automatically selected from the /etc/login.defs file depending on the UID_MIN and UID_MIN values.


Normal users should have a UID between 1000 and 60000. Knowing the minimal and maximal value allow us to query a list of all normal users in our system.




CERTIFIED CLOUD EXPERTS | AWS PARTNER NETWORK
CLOUD CONSULTING FIRM | (516) 387-2085 | CONTACT US