How to Get Linux Server Sends Email Alert on Root Login如何讓Linux服務器發送電子郵件警報對根登錄

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.以改善安全的服務器上,尤其是Web服務器,這暴露了以互聯網和世界各地盡可能多的黑客,最好的,使服務器自動發送通知郵件到預定義的電子郵件地址,每次有人記錄在以root的身份向東道國。 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.配置自動電子郵件警報通知預設的電子郵件地址,每個事件的根源日誌就在服務器上,使用下列指南。

  1. Login to the server via SSH using as root ID.登錄到該服務器通過SSH使用,以root的身份識別碼。
  2. Ensure that you’re at home directory of root.確保您在主目錄的根。 The open up the .bash_profile for editing using pico or vi by typing one of the following commands at command shell line:開放了。 bash_profile編輯或使用微微六鍵入下列命令之一,在命令外殼行:

    pico .bash_profile微微。 bash_profile
    vi .bash_profile六。 bash_profile

  3. Scroll down to the end of the file and add the following line:向下滾動,到去年底,該文件並添加下面一行:


    echo 'ALERT - Root Shell Access on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" user@example.com 迴聲'快訊-根殼准入對: ' `日期` `誰` |郵件- S的“警報:根訪問`誰|割喉式D ”類( “ - F 2進入|割喉式D ”類) “ - F 1的` ”用戶@ example.com

    Replace user@email.com with the actual email account address that you want to the root access alert notification been sent to.取代user@email.com與實際地址的電子郵件帳戶您要訪問的根源,提高警覺,通知被送往。 Note that you can change the text contains in the email alert 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.文本開始,首先發出警報是書面作為電子郵件正文,您可以添加在其他信息,如主機名稱或變更的字眼。 The second Alert is the email title which you can change to your own too.第二是提高警覺,電子郵件標題,您可以改變自己。

Now logout and login again as root, you should receive an email alert at your inbox.現在註銷,並再次登錄,以root的身份,你應該收到一封電子郵件,提醒在您的收件箱。 The security trick should works on most popular flavor of Linux such as RedHat, CentOS, Ubuntu, FreeBSD and etc.安全理事會的伎倆,應該對工程最熱門的風味的Linux如RedHat作業, centos , Ubuntu的, FreeBSD和等。

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article原來的英語文章 whenever possible.只要有可能。

Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 .



2 Responses to “How to Get Linux Server Sends Email Alert on Root Login” 2反應, “如何讓Linux服務器發送電子郵件警報對根登錄”

  1. Linux - wysyłanie maila o logowaniu na konto roota « Barni.LOG Linux的-w ysyłaniem ailao l ogowaniu娜的帳戶r oota« b arni.log
    August 12th, 2007 03:10 2007年8月12日3時10分
    1

    [...] Linux - wysyłanie maila o logowaniu na konto roota Bardzo użyteczny skrypcik [...] [ … … ] Linux的-w ysyłaniem ailao l ogowaniu娜的帳戶r ootab ardzou żytecznys krypcik[ … … ]

  2. Jon
    May 3rd, 2008 05:43 2008年5月3日5時43分
    2

    ‘who -m’ makes the output much cleaner when using this on a system that has multiple users logged on… '是誰米' ,使輸出更潔淨當使用此一系統,有多個用戶登錄的…

    -m reports only hostname and user associated with stdin terminal -米的報告,只有主機和用戶的相關標準輸入終端

Leave a Reply離開的答复

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用這些標籤:的<a href="" title=""> <abbr title=""> <acronym title="">的<b> <blockquote cite=""> <cite>的<code> <刪除日期時間= “ ” >的<em>的<i> <q cite=""> <strike>的<strong>

Subscribe without commenting訂閱無評論


Custom Search

New Articles新的條款,

Incoming Search Terms for the Article傳入的搜索條件文章

linux email alerts Linux的電子郵件快訊 - - linux turn off mail notification Linux的關閉郵件通知 - - linux change root email address Linux的變更根的電子郵件地址 - - change root email 改變的root email - - linux change root email Linux的改變的root email - - linux mail root Linux的郵件根 - - change root email address 變更根的電子郵件地址 - - linux root email address Linux的根的電子郵件地址 - - linux root mail Linux的根郵件 - - mail alerts in linux 電子郵件警報在Linux - - email when root logs on 電子郵件時,根原木就 - - linux root login alert Linux的根登錄警報 - - turn off mail notification linux 關閉郵件通知的Linux - - linux mail from address Linux的郵件地址 - - email alerts linux Linux的電子郵件快訊 - - linux server email security notifications Linux服務器的電子郵件安全的通知 - - linux mail change from address Linux的郵件地址改變,從 - - email alert when linux server is login 電子郵件警報時, Linux服務器是登錄 - - Change root mail 變更根郵件 - - root mail linux 根郵件的Linux - - linux email alert Linux的電子郵件警報 - - linux root login mail Linux的根登錄郵件 - - linux send email login Linux的發送電子郵件登錄 - - send email on login linux 發送電子郵件上登錄的Linux - - email for root 電子郵件為根 - - linux send email on ssh login Linux的傳送電子郵件的SSH登錄 - - linux login alert Linux的登錄警報 - - linux notify on login Linux的通知就登錄 - - linux login notification Linux的登錄通知 - - linux email root logs Linux的電子郵件根原木 - - set root mail 集根目錄郵件 - - linux mail an root Linux的郵件1根 - - linux system send alerts rss -news Linux系統發送警報的RSS新聞 - - server email notifications 服務器的電子郵件通知 - - linux server status mail Linux服務器的地位郵件 - - linux root email as different user Linux的根電子郵件作為不同的用戶 - - ssh alert linux SSH的警覺的Linux - - where do we find mail for root + linux 如果我們找不到郵件為Linux的根+ - - mail logins linux 郵件登錄的Linux - - mail root linux 郵件Linux的根 - - linux change root mail Linux的變更根郵件 - - redhat linux directory file access email alert notification 版RedHat Linux的目錄檔案存取電子郵件警報通知 - - linux mail to root Linux的郵件,以根 - - all 全部 - - linux root alert Linux的根警報 - - linux some one is sending mail from my server who Linux的一些,一個是發送郵件,從我的服務器誰 - - server to email logs linux 服務器的電子郵件記錄的Linux - - mail alert linux 郵件提醒的Linux - - linux email root Linux的電子郵件根 - - ubuntu mail command line server change root email address Ubuntu的郵件服務器的命令行變更根的電子郵件地址 - -