I’m trying to send user login logs to my email with the users name and location. After making the script I found that environment variables can’t run in this script, I’m hoping that someone out there can help me get this working even if it’s a security problem. Thanks for your time
/etc/update-motd.d/99-footer
ssmtp -oi me@gmail.com << EOF
To: me@gmail.com
Subject: Login
$SUDO_USER" from "$SSH_CLIENT
EOF
email output is
Subject: Login
from
$SUDO_USER" from "$SSH_CLIENTis somewhat strange syntax. try to use"$SUDO_USER from $SSH_CLIENT"or even better ${SUDO_USER} etc. But this woh't help, I guess - where are the environment variables SUDO_USER and SSH_CLIENT defined? – ohno May 27 '12 at 18:25