Script for mailing /etc/passwd information

Manuel Aróstegui manuel at todo-linux.com
Mon Jun 1 13:30:40 UTC 2009


On Mon, 2009-06-01 at 16:22 +0300, a bv wrote:
> Hi ,
> Thanks fro the answer. Wont this mail the whole /etc/passwd file?
> What about getting only the user names and the usernames shell
> information?

This is the first approach that comes to my mind:

for l in $(cut -f1,7 -d: /etc/passwd ); do echo "$(echo $l |cut -f1 -d:)
$(echo $l|cut -f2 -d:)" | mail -s "whatever" user at domain.com ; done

This will email the user and the bash (an email per user)

Manuel.




More information about the redhat-list mailing list