What Bash commands can I use to enumerate users on a Linux system during a security audit

+1 vote
I’m performing a security audit on a Linux system and one of the tasks is to enumerate all users and identify any potential issues with user permissions or accounts that may pose a security risk. I know the /etc/passwd file contains user information, but I’m not sure if there are other Bash commands that can help me gather more detailed information, such as user groups, last login times, or password settings.

What Bash commands can I use to efficiently enumerate users and check for weak spots in user account security? Any additional tips on what to look for in user enumeration would also be appreciated.
Oct 17, 2024 in Cyber Security & Ethical Hacking by Anupam
• 9,050 points
122 views

1 answer to this question.

+1 vote

At the time of a security audit, we can use a combination of Bash commands to enumerate users and gather details about their settings.

1. To list all the users

cat /etc/passwd

2. To check for users with login shells

awk -F':' '$7 ~ /\/bin\/bash/ {print $1}' /etc/passwd

3. To list user groups

cut -d: -f1 /etc/group

4. To show last login of each user

lastlog

5. To check the password policies

sudo cat /etc/shadow

All these files can be inspected while performing a security audit to identify any user accounts with weak or no passwords, interactive users, and misconfigurations.

answered Oct 22, 2024 by CaLLmeDaDDY
• 13,760 points
Great list of commands! This will be really useful for auditing Linux systems. Thanks for the clear and straightforward explanation!

Related Questions In Cyber Security & Ethical Hacking

0 votes
0 answers

What techniques can I use in Python to analyze logs for potential security breaches?

What techniques can I use in Python ...READ MORE

Oct 14, 2024 in Cyber Security & Ethical Hacking by Anupam
• 9,050 points
96 views
0 votes
1 answer

What tools can I use to enumerate time servers and check for misconfigurations?

To guarantee the security and integrity of ...READ MORE

answered Nov 19, 2024 in Cyber Security & Ethical Hacking by CaLLmeDaDDY
• 13,760 points
96 views
+1 vote
1 answer

How do you decrypt a ROT13 encryption on the terminal itself?

Yes, it's possible to decrypt a ROT13 ...READ MORE

answered Oct 17, 2024 in Cyber Security & Ethical Hacking by CaLLmeDaDDY
• 13,760 points
173 views
+1 vote
1 answer

How does the LIMIT clause in SQL queries lead to injection attacks?

The LIMIT clause in SQL can indeed ...READ MORE

answered Oct 17, 2024 in Cyber Security & Ethical Hacking by CaLLmeDaDDY
• 13,760 points
341 views
+1 vote
1 answer

Is it safe to use string concatenation for dynamic SQL queries in Python with psycopg2?

The use of string concatenation while building ...READ MORE

answered Oct 17, 2024 in Cyber Security & Ethical Hacking by CaLLmeDaDDY
• 13,760 points
181 views
+1 vote
1 answer
+1 vote
1 answer

What techniques can I use in Python to analyze logs for potential security breaches?

To analyze logs for potential security breaches, ...READ MORE

answered Oct 23, 2024 in Cyber Security & Ethical Hacking by CaLLmeDaDDY
• 13,760 points
141 views
0 votes
1 answer

What LDAP query can be used to enumerate all users in a directory?

Creating an LDAP search query with the ...READ MORE

answered Nov 18, 2024 in Cyber Security & Ethical Hacking by CaLLmeDaDDY
• 13,760 points
81 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP