How to Get Linux Server Sends Email Alert on Root Login Kā Get Linux Server Sūta e-pasta brīdinājumu par Root Login
To improve the security of the server, especially web server which exposes to the Internet and possible worldwide hackers, it's best to enable server to automatically send a notification email to predefined email address everytime someone logs in as root to the host. Lai uzlabotu drošību, servera, jo īpaši interneta serveri, kas pakļauj ar internetu, un, iespējams, visā pasaulē hackers, ir labākais, kas ļautu serverim automātiski nosūtīs paziņojumu e-pastu uz iepriekš definētu e-pasta adrese everytime kāds apaļkoku kā root uz uzņēmējvalsti. To configure the automatic email alert notification to a default email address on each incident of root log on on the server, use the following guide. Lai konfigur automātisku e-pasta brīdinājumu paziņojumu noklusēto e-pasta adresi, uz katra starpgadījuma saknes pieteikties uz servera, izmantojiet šādas guide.
- Login to the server via SSH using as root ID. Login to servera, izmantojot SSH izmantojot sakņu ID.
- Ensure that you're at home directory of root. Pārliecinieties, ka esat mājās directory saknes. The open up the .bash_profile for editing using pico or vi by typing one of the following commands at command shell line: Ar atvērtu. Bash_profile rediģēt, izmantojot Pico vai vi mašīnrakstā vienu no šiem komandas pie command shell pozīcija:
pico .bash_profile Pico. bash_profile
vi .bash_profile vi. bash_profile - Scroll down to the end of the file and add the following line: Ritiniet uz leju līdz beigām, failu un pievienot šādas pozīcija:
echo 'ALERT - Root Shell Access on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" user@example.comReplace user@email.com with the actual email account address that you want to the root access alert notification been sent to. Aizstāt user@email.com ar faktisko e-pasta kontu adresi, kuru vēlaties saknes piekļuve trauksmes paziņojums ir nosūtīts uz. Note that you can change the text contains in the email alert too. Ievērojiet, ka varat mainīt teksta satur e-pasta brīdinājumu too. The text starting with first ALERT is written as email body, and you can add in other info such as host name or change the wordings. Tekstu, sākot ar pirmo brīdinājumu ir uzrakstīts, e-pasta ķermeņa, un jums var pievienot citu informāciju, piemēram, uzņēmēja vārds vai mainīt formulējumu. The second Alert is the email title which you can change to your own too. Otro brīdinājumu, ir e-pasta virsrakstā, ko varat mainīt uz jūsu too.
Now logout and login again as root, you should receive an email alert at your inbox. Tagad logout un login atkal, kā root, jums ir jāsaņem e-pasta brīdinājumu jūsu inbox. The security trick should works on most popular flavor of Linux such as RedHat, CentOS, Ubuntu, FreeBSD and etc. Drošības triks būtu darbu populārākās aromāts no Linux, piemēram, RedHat, CentOS, Ubuntu, FreeBSD utt
IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: Šī lapa ir mašīna tulkoto un ar nosacījumu ", kas ir" bez garantijas. Machine translation may be difficult to understand. Machine translation var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.
Related Articles Saistītie raksti
- Disable Direct Root Login and User Access via SSH to Server Disable Direct Root Login un lietotāja Piekļuve caur SSH, lai Server
- Reset the Root Password of MySQL Server Reset to Root paroli MySQL Server
- Sign Up as @Gmail.com Instead Of @GoogleMail.com As Email Address and Login Sign Up as@Gmail.com vietā Of@GoogleMail.com, e-pasta adrese un Login
- How to Send an Email (Mail Message) from Linux Command Line Shell Kā Nosūtīt e-pastu (pasta ziņu) no Linux Command Line Shell
- How to Disable Linux and Unix Cron Jobs (Crontab) Email Sending Kā Atslēgt Linux un Unix Cron darbavietām (Crontab) E-pasts sūtīšana
- Reveal and Recover Windows NT, 2000, XP, 2003 and Longhorn Login (including Administrator) Username and Password with Login Recovery Atklāt un atgūt Windows NT, 2000, XP, 2003 un Longhorn Login (ieskaitot Administrator) Lietotājvārds un Parole ar Login Atgūšana
- Disable and Turn Off Telnet in Linux Disable un Izslēgt Telnet in Linux
- Change and Reset MySQL root Password Pārmaiņām un Reset MySQL root parole
- How to Check Memory Usage in Linux based Server Kā pārbaudīt Memory izmantošana Linux balstās Server
- How to Change or Spoof MAC Address in Windows XP, Vista, Server 2003/2008, Mac OS X, Unix and Linux Kā nomainīt vai šmaukšana MAC Adrese Windows XP, Vista, Server 2003/2008, Mac OS X, Unix un Linux










































November 21st, 2008 03:41 Novembris 21, 2008 03:41
Great stuff, Great stuff,
Is there a way to have the IP of the person who logs in show up? Vai ir tā, ka IP ir persona, kas baļķi, kas parādīsies?
November 1st, 2008 03:06 1 novembris, 2008 03:06
This works for root login or su – from a user login. Šis darbi root login vai su - no lietotāja pieteikumvārdu.
How can I implement it that will work also for “su” only? Kā es varu īstenot to, ka strādās arī ar "su" tikai? Right now since the path will change with su instead of su – it will not send an email if someone is not using the “-” after the su. Uz doto brīdi, jo ceļš mainīsies ar su vietā su - tā nebūs, sūtiet e-pastu, ja kāds nav izmantojot "-" pēc tam, kad su. Thanks. Pateicība.
May 3rd, 2008 05:43 Maijs 3, 2008 05:43
'who -m' makes the output much cleaner when using this on a system that has multiple users logged on… "kas-m" padara produkcijas daudz tīrāku, izmantojot šo uz sistēmu, kas ir vairākiem lietotājiem pieteicies uz ...
-m reports only hostname and user associated with stdin terminal -m ziņojumus tikai resursdatora un lietotāju saistītas ar stdin termināls
August 12th, 2007 03:10 Augusts 12, 2007 03:10
[...] Linux – wysyłanie maila o logowaniu na konto roota Bardzo użyteczny skrypcik [...] [...] Linux - wysyłanie maila o logowaniu na konto roota Bardzo użyteczny skrypcik [...]