Giter Site home page Giter Site logo

sendmailonsshrootconection's Introduction

SendMailOnSSHRootConection

Enviar un Correo cuando conecte el usuario ROOT por SSH al servidor remoto

:'######::'########::'######::'##::::'##:'########::'####:'########:'##:::'##:
'##... ##: ##.....::'##... ##: ##:::: ##: ##.... ##:. ##::... ##..::. ##:'##::
 ##:::..:: ##::::::: ##:::..:: ##:::: ##: ##:::: ##:: ##::::: ##:::::. ####:::
. ######:: ######::: ##::::::: ##:::: ##: ########::: ##::::: ##::::::. ##::::
:..... ##: ##...:::: ##::::::: ##:::: ##: ##.. ##:::: ##::::: ##::::::: ##::::
'##::: ##: ##::::::: ##::: ##: ##:::: ##: ##::. ##::: ##::::: ##::::::: ##::::
. ######:: ########:. ######::. #######:: ##:::. ##:'####:::: ##::::::: ##::::
:......:::........:::......::::.......:::..:::::..::....:::::..::::::::..:::::  

╔════════════════╗
|       100%     |
╚════════════════╝

Explicacion del Script

Este Script captura la IP de la visita, y envia un correo informando de una nueva conexión con el usuario Root al servidor: H(Host Name) desde la IP (IP_CONNECTION), y a la hora X(NOW) es muy sencillito y a mi me funciona, espero le sirva a alguien

COMO USAR

1 Modificar las variables del fichero SendMail.sh acorde a sus necesidades. IMPORTANTE variable TO -> pon tu correo

2 Dar permisos de eecucion al fichero.

chmod +x SendMail.sh

3 Probar. se puede ejecutar directamente el fichero:

./SendMail.sh

Si deseamos que se ejecute cuando el usuario Root hace login mediante SSH haremos la llamada al fichero en el archivo .bash_profile en la carpeta /root así pues el fichero nos quedaría tal que así: debajo

# User specific enviroment and startup programs
export PATH

XXXXXXXXXXXXXXXXXXXXXXX

# aquí ponemos  la llamada al fichero, si por ejemplo se encuentra en la raiz (/) la llamada sería:
#sh /SendMail.sh

# si el fichero SendMail.sh se encuentra en la ruta /root la llamada sería
#sh /root/SendMail.sh

Funcion mail

Este script hace uso de la función mail del servidor, si no está habilitada o instalada no funcionará.

sendmailonsshrootconection's People

Contributors

borazuwarah avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.