How to Get Linux Server Sends Email Alert on 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. כדי לשפר את האבטחה של שרת, במיוחד שרת האינטרנט בו כדי לחשוף את האינטרנט ואת האפשרי בעולם האקרים, מומלץ להפעיל את השרת באופן אוטומטי כדי לשלוח הודעת דוא"ל אל כתובת הדוא"ל מוגדרים מראש בכל פעם שמישהו יתחבר כ השורש של המארח. 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 באמצעות תעודות כמו השורש.
  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 VI או על ידי הקלדה אחת את הפקודות הבאות ב מעטפת שורת הפקודה:

    pico .bash_profile pico. bash_profile
    vi .bash_profile VI. 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

    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. הטקסט הראשון החל התראה כתוב כמו דוא"ל הגוף, ואתה יכול להוסיף מידע אחר, כגון שם המחשב המארח או לשנות את 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. אבטחה טריק צריך עובדת הכי פופולרי טעם של לינוקס כגון RedHat, CentOS, Ubuntu, FreeBSD וכו 'ו

IMPORTANT : The page is machine translated and provided "as is" without warranty. חשוב: הדף הוא מכונה בתרגום ובתנאי "כמות שהוא", ללא אחריות. Machine translation may be difficult to understand. תרגום מכונה יכול להיות קשה להבין. Please refer to אנא פנה ל original English article המאמר המקורי באנגלית whenever possible. ככל שניתן.


4 Responses to “How to Get Linux Server Sends Email Alert on Root Login” 4 תגובות ל "איך לקבל שרת לינוקס שולח אימייל התראה על שורש התחברות"

  1. dean דיקן
    November 21st, 2008 03:41 נובמבר 21, 2008 03:41
    4 4

    Great stuff, דברים נהדר,

    Is there a way to have the IP of the person who logs in show up? האם ישנה דרך לקבל את ה-IP של אדם שנכנס להופיע?

  2. Emilio אמיליו
    November 1st, 2008 03:06 1 בנובמבר, 2008 03:06
    3 3

    This works for root login or su - from a user login. זה עובד עבור שורש או התחברות su - מ משתמש התחברות.
    How can I implement it that will work also for “su” only? איך אני יכול ליישם את זה, כי יפעל גם עבור "su" בלבד? 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. עכשיו מאז הנתיב ישתנה עם su במקום su - זה יהיה לא לשלוח דוא"ל, אם מישהו הוא לא משתמש "-" אחרי su. Thanks. תודה.

  3. Jon Jon
    May 3rd, 2008 05:43 3 במאי, 2008 05:43
    2 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 -M דוחות רק המארח והמשתמשים המשויכים stdin מסוף

  4. Linux - wysyłanie maila o logowaniu na konto roota « Barni.LOG לינוקס - wysyłanie maila O logowaniu na konto roota «Barni.LOG
    August 12th, 2007 03:10 אוגוסט 12th, 2007 03:10
    1 1

    [...] Linux - wysyłanie maila o logowaniu na konto roota Bardzo użyteczny skrypcik [...] [...] לינוקס - wysyłanie maila O logowaniu na konto roota bardzo użyteczny skrypcik [...]

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> <דל datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. הצטרף כמנוי ל הערות תכונה הושבת. To receive notification of latest comments posted, subscribe to כדי לקבל הודעה על תגובות העדכנית פורסם, כדי להירשם My Digital Life Comments RSS feed החיים שלי דיגיטלי תגובות RSS Feed or או register to receive הרשמה לקבלת new comments in daily email digest. תגובות חדש ב דוא"ל תקציר יומי.
Custom Search

New Articles מאמרים חדשים

Incoming Search Terms for the Article חיפוש נכנס על תנאי סעיף

linux mail change from address Linux שינוי כתובת דואר - -- linux login email notification הודעת דוא"ל לאישור הכניסה - -- linux set user email Linux בחר משתמש בדוא"ל - -- wordpress blogs wordpress בלוגים - -- linux remote login notify Linux להודיע התחברות מרחוק - -- Alert: Root Access from התראת: שורש גישה מ - -- linux get administrator e-mail address מנהל Linux לקבל כתובת דואר אלקטרוני - -- linux send email when user login Linux שלח כאשר משתמש התחבר - -- how can I have alert everytime if someone login my server via root user כיצד אוכל לקבל התראה בכל פעם שמישהו התחברות אם השרת שלי דרך השורש המשתמש - -- configure linux to send email alerts כדי להגדיר את לינוקס שלח התראות - -- notify to email when accessing to linux server להודיע לדוא"ל כאשר הגישה אל שרת לינוקס - -- change root email שינוי השורש דוא"ל - -- configure linux to send alert emails להגדיר Linux לשלוח התראת דוא"ל - -- email alert linux התראת הדוא"ל Linux - -- linux alert trigger email Linux להפעיל התראת דוא"ל - -- linux alert Linux התראה - -- linux log, how to send to email יומן Linux, כיצד לשלוח לדוא"ל - -- change emailaddress root user שינוי emailaddress שורש המשתמש - -- change user mail linux החלף משתמש דואר Linux - -- linux mail change address שינוי כתובת הדואר Linux - -- linux root email Linux שורש דוא"ל - -- linux root email Linux שורש דוא"ל - -- mail login de root דואר דה התחברות שורש - -- mail alert when login as root מייל התראה כאשר הכניסה כפי שורש - -- changer le mail de root מחלף לה דואר דה שורש - -- linux alert login Linux התראה התחברות - -- linux send root email Linux שלח דוא"ל שורש - -- linux root email address Linux שורש כתובת דוא"ל - -- Linux send logs in email לינוקס יומני שלח בדוא"ל - -- receive email when someone login via ssh תקבל דוא"ל כאשר מישהו התחברות דרך SSH - -- send mail on root login לשלוח דואר על בסיס התחברות - -- set root mail בחר דואר שורש - -- alert root access linux התראה השורש גישה Linux - -- email on login linux דוא"ל ההתחברות ב-Linux - -- how to email alerts in linux כיצד התראות דוא"ל ב-Linux - -- linux email notification failed logon Linux הודעת דוא"ל הכניסה נכשלה - -- linux get new mail notification Linux לקבל הודעה על דואר חדש - -- linux email on login Linux דוא"ל על התחברות - -- root email address שורש כתובת דוא"ל - -- root mail linux דואר שורש Linux - -- send email new user created linux server שלח משתמש חדש שנוצר Linux Server - -- sending email to root in linux שליחת דוא"ל אל השורש ב-Linux - -- "ALERT - Root Shell Access on" "Alert - שורש מעטפת על גישה" - -- change root email in linux שינוי השורש דוא"ל Linux - -- configurar email do root no linux configurar דוא"ל לעשות שום בסיס לינוקס - -- email alerting on linux דוא"ל alerting on Linux - -- get server email alerts on the root login שרת הדוא"ל לקבל התראות על הבסיס התחברות - -- linux sendmail redirect root Linux sendmail להפנות שורש - -- linux, configure alerting לינוקס, הגדר alerting - -- linux send mail when user logs in Linux שלח מייל כאשר המשתמש יתחבר ב - --