Notificar por e-mail qualquer login por ssh

Sem Comentários

Neste link achei uma dica bem legal de como configurar o envio de email para qualquer login feito via SSH no seu servidor.

Edite o arquivo

/etc/bashrc

Ao final do arquivo adicione o seguinte bloco.

if ! shopt -q login_shell ; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
else
# Send alert to server admin
echo 'ALERT - Shell Access on:' `date` `who` | mail -s "Alert: Shell Access on Server `hostname` from `who | awk '{print $6}'`" root
fi

Na linha em negrito acima somente altere o seu email e o conteudo do email.

 

Fonte: Alan http://conf.com.br/blog/

Sobre o blog

Este Blog tem o objetivo de divulgar as novidades da WebinHost e compartilhar notícias sobre hosting, servidores, empreendedorismo e todo universo tecnológico.

Arquivos

Comente via Facebook
Sem Comentários
 

Deixe uma resposta