How to Get Linux Server Sends Email Alert on Root Login Ako sa k nám Linux Server Odošle Email Alert na Root Prihlásiť
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. K zlepšeniu bezpečnosti na server, web server, ktorý najmä vystavuje na internete a možno na celom svete hackermi, je to najlepšie k tomu, aby server automaticky odoslať email s oznámením na preddefinované e-mailovej adresy vždy niekto prihlási ako root na hostiteľa. 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. Ak chcete nastaviť automatický email záznamu oznámenia na predvolený e-mailovú adresu, na každý incident zo root prihlásite na server, použite nasledujúci návod.
- Login to the server via SSH using as root ID. Prihlásiť sa k serveru cez SSH s použitím ako root ID.
- Ensure that you're at home directory of root. Zabezpečiť, že máte doma v koreňovom adresári. The open up the .bash_profile for editing using pico or vi by typing one of the following commands at command shell line: K otvoreniu. Bash_profile editace pomocou pico vi alebo zadaním jednej z nasledujúcich príkazov na príkazový riadok shellu:
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: Prejdite na koniec súboru pridajte nasledujúci riadok:
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. Nahradiť user@email.com s aktuálne e-mailovú adresu účtu, ktorý chcete koreňové prístup záznam oznámenie bolo odoslané. Note that you can change the text contains in the email alert too. Všimnite si, že môžete meniť text obsahuje v e-mailu varovania príliš. 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. Text začínajúci na prvý záznam je zapísaný ako text e-mailu, a môžete pridať ďalšie informácie, napríklad názov hostiteľa alebo zmenu formulácie. The second Alert is the email title which you can change to your own too. Druhý Alert je email titul, ktorý si môžete zmeniť na svoje vlastné moc.
Now logout and login again as root, you should receive an email alert at your inbox. Teraz odhlásiť a znovu prihlásiť ako root, mali by ste dostať e-mailové upozornenia na svojej e-mailovej schránky. The security trick should works on most popular flavor of Linux such as RedHat, CentOS, Ubuntu, FreeBSD and etc. Zábezpeka by trik funguje na najpopulárnejšie varianta pre Linux, ako je RedHat, CentOS, Ubuntu, FreeBSD atď
IMPORTANT : The page is machine translated and provided "as is" without warranty. Upozornenie: Stránka je stroje preložené a poskytované "tak ako sú" bez záruky. Machine translation may be difficult to understand. Strojový preklad môže byť ťažké pochopiť. Please refer to Obráťte sa prosím na original English article Anglický originál článku whenever possible. kedykoľvek je to možné.
Related Articles Súvisiace články
- Disable Direct Root Login and User Access via SSH to Server Zakázať Direct Root Prihlásenie užívateľa a prístup cez SSH na server
- Reset the Root Password of MySQL Server Reset root hesla na MySQL servera
- Sign Up as @Gmail.com Instead Of @GoogleMail.com As Email Address and Login Zaregistruj sa as@Gmail.com Miesto Of@GoogleMail.com Ako e-mailovú adresu a Prihlásiť
- How to Send an Email (Mail Message) from Linux Command Line Shell Ako poslať e-mail (Mail Message) z Linux Command Line Shell
- How to Disable Linux and Unix Cron Jobs (Crontab) Email Sending Ako zakázať Linux a Unix Cron Jobs (crontab) Email Odoslanie
- Reveal and Recover Windows NT, 2000, XP, 2003 and Longhorn Login (including Administrator) Username and Password with Login Recovery Odhaliť a Recover Windows NT, 2000, XP, 2003 a Longhorn Prihlásenie (vrátane Správca) Username a Heslo so Prihlásiť zotavenie
- Disable and Turn Off Telnet in Linux Zakázať a Vypnúť Telnet v Linuxe
- Change and Reset MySQL root Password Zmena a Reset MySQL root Heslo
- How to Check Memory Usage in Linux based Server Ako Kontrola využitia pamäte v Linuxe založené Server
- How to Change or Spoof MAC Address in Windows XP, Vista, Server 2003/2008, Mac OS X, Unix and Linux Ako zmeniť alebo Spoof MAC adresa vo Windows XP, Vista, Server 2003/2008, Mac OS X, Unix a Linux










































November 21st, 2008 03:41 21. november 2008 03:41
Great stuff, Great stuff,
Is there a way to have the IP of the person who logs in show up? Existuje spôsob, ako mať IP adresu osoby, ktorí sa prihlási až v show?
November 1st, 2008 03:06 1. novembra 2008 03:06
This works for root login or su – from a user login. Táto práca pre root prihlásiť alebo nie - od užívateľa prihlásení.
How can I implement it that will work also for “su” only? Ako môžem implementovat to, že bude fungovať aj pre "nie" len? 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. Práve teraz, pretože cesta sa bude meniť v su namiesto su - nebudeme posielať e-mailom, ak niekto nie je pomocou "-" po su. Thanks. Vďaka.
May 3rd, 2008 05:43 3. máj 2008 05:43
'who -m' makes the output much cleaner when using this on a system that has multiple users logged on… ', Ktorí-m' je oveľa čistejšie produkcie pri použití na systéme, ktorý má viac užívateľov prihlásený ...
-m reports only hostname and user associated with stdin terminal -m správy iba používateľské meno a spojené s stdin terminálu
August 12th, 2007 03:10 12. augusta 2007 03:10
[...] Linux – wysyłanie maila o logowaniu na konto roota Bardzo użyteczny skrypcik [...] [...] Linux - wysyłanie maila o Logowanie na konto roota Bardzo użyteczny skrypcik [...]