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. Для підвищення безпеки сервера, особливо веб-сервер, який виставляє в Інтернет, і, можливо, в світі хакерів, краще, щоб сервер автоматично відправити повідомлення електронною поштою на адресу електронної пошти, попередньо кожен раз хто-то входить в якості суперкористувача для перебування. 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, використовуючи в якості кореневої ID.
- 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 для редагування з допомогою піку або VI, набравши одна з наступних команд в командному рядку оболонки:
pico .bash_profile піку. 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. Цей текст, починаючи з першого ALERT написана як електронний орган, і ви можете додати інформацію в інших, таких як ім'я хоста або змінити формулювання. 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. Тепер ви вийдете з системи і ввійти знову, як корінь, ви повинні отримати повідомлення по електронній пошті на Вашу поштову скриньку. 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 : 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 Server
- Sign Up as @Gmail.com Instead Of @GoogleMail.com As Email Address and Login Зареєструйся as@Gmail.com Замість Of@GoogleMail.com як адреса електронної пошти та Логін
- How to Send an Email (Mail Message) from Linux Command Line Shell Як відправити листа (листа) з командного рядка Linux Shell
- How to Disable Linux and Unix Cron Jobs (Crontab) Email Sending Як відключити Linux та Unix Робота Cron (Crontab) Email Відправлення
- 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 грунтується Server
- How to Change or Spoof MAC Address in Windows XP, Vista, Server 2003/2008, Mac OS X, Unix and Linux Як змінити або Spoof MAC-адреси в Windows XP, Vista, Server 2003/2008, Mac OS X, Linux та Unix










































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. Це працює для кореневої логін або нд - від входу користувача.
How can I implement it that will work also for “su” only? Як я можу здійснити це, що буде працювати також і для "Су" тільки? 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. В даний час, оскільки шлях буде змінюватися з Су замість нд - він не буде відправляти по електронній пошті, якщо хто-то не з допомогою "-" після того, нд. 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 м звітів хосту і користувача, пов'язані з STDIN термінал
August 12th, 2007 03:10 12 серпня 2007 03:10
[...] Linux – wysyłanie maila o logowaniu na konto roota Bardzo użyteczny skrypcik [...] [...] Linux - wysyłanie maila O logowaniu на Konto roota Bardzo użyteczny skrypcik [...]