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. כדי להגדיר את ההתראה הודעת דוא"ל אוטומטית על ברירת המחדל של כתובת הדוא"ל על כל מקרה של השורש להיכנס בשרת, השתמש במדריך הבא.
- Login to the server via SSH using as root ID. התחברות לשרת דרך SSH באמצעות תעודות כמו השורש.
- 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 - 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.comReplace 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. ככל שניתן.
Related Articles מאמרים קשורים
- Disable Direct Root Login and User Access via SSH to Server שורש כניסת השבת ישיר והמשתמש גישה לשרת דרך SSH
- Reset the Root Password of MySQL Server איפוס סיסמא השורש של שרת MySQL
- Sign Up as @Gmail.com Instead Of @GoogleMail.com As Email Address and Login הרשמה as@Gmail.com במקום Of@GoogleMail.com כמו כתובת דוא"ל והכניסה
- Reveal and Recover Windows NT, 2000, XP, 2003 and Longhorn Login (including Administrator) Username and Password with Login Recovery לחשוף שחזר ו-Windows NT, 2000, XP, 2003 ו Longhorn התחברות (כולל המנהל) עם שם המשתמש והסיסמה התחברות השחזור
- Disable and Turn Off Telnet in Linux השבת ואת כיבוי Telnet ב-Linux
- Change and Reset MySQL root Password שינוי סיסמה אפס MySQL שורש
- How to Check Memory Usage in Linux based Server כיצד לבדוק שימוש בזיכרון ב-Linux מבוסס שרת
- How to Change or Spoof MAC Address in Windows XP, Vista, Server 2003/2008, Mac OS X, Unix and Linux כיצד לשנות או מתיחה כתובת MAC ב-Windows XP, Vista, Server 2003/2008, Mac OS X, Unix ו-Linux
- Open, Extract and Convert DAA, ISO and BIN Files in Linux with Free PowerISO for Linux פתח, חלץ ו DAA המר, ISO ו המיחזור קבצים ב-Linux עם PowerISO חינם עבור לינוקס
- Novell SUSE Linux Enterprise Server 10 Reviews הרשמה Novell Linux Enterprise Server 10 ביקורות










































November 21st, 2008 03:41 נובמבר 21, 2008 03:41
Great stuff, דברים נהדר,
Is there a way to have the IP of the person who logs in show up? האם ישנה דרך לקבל את ה-IP של אדם שנכנס להופיע?
November 1st, 2008 03:06 1 בנובמבר, 2008 03:06
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. תודה.
May 3rd, 2008 05:43 3 במאי, 2008 05:43
'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 מסוף
August 12th, 2007 03:10 אוגוסט 12th, 2007 03:10
[...] 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 [...]