Linux 4 All

Best Linux tricks source

A small and simple script to get users from a RHEL/CentOS box. It assumes that first UID is 500 and it won’t go beyond UID 999

1. Get all users

awk -F ":"  '$3>=500 && $3<1000  {print $1}' /etc/passwd

2. Get users with valid shell.

awk -F ":"  '($3>=500 && $3<1000) && ($7 ~ /sh/) {print $1,$7}' /etc/passwd

3. Get ftp users

awk -F ":"  '($3>=500 && $3<1000) && ($7 !~ /sh/) {print $1,$7}' /etc/passwd

How To get Plesk email accounts and passwords arrow-right
Next post

arrow-left Strip html tags
Previous post

Leave a Reply

Your email address will not be published. Required fields are marked *