How to Get Linux Server Sends Email Alert on Root Login Dapatkan cara Server Linux Mengirim Email Alert pada 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. Untuk meningkatkan keamanan server, khususnya web server yang exposes ke Internet di seluruh dunia dan kemungkinan hacker, maka untuk mengaktifkan server secara otomatis mengirim email pemberitahuan ke alamat email standar seseorang setiap kali log in sebagai root untuk 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. Untuk mengkonfigurasi email otomatis tanda pemberitahuan ke alamat email default pada setiap kejadian akar login di server, gunakan panduan berikut ini.
- Login to the server via SSH using as root ID. Login ke server melalui SSH menggunakan ID sebagai root.
- Ensure that you're at home directory of root. Pastikan Anda di rumah direktori akar. The open up the .bash_profile for editing using pico or vi by typing one of the following commands at command shell line: Yang terbuka di atas. Bash_profile untuk mengedit menggunakan pico atau vi dengan mengetikkan salah satu perintah berikut di baris perintah shell:
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: Gulir ke bawah ke bagian akhir file tersebut dan menambahkan baris berikut:
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. Ganti user@email.com dengan alamat sebenarnya account email yang ingin Anda akses root tanda pemberitahuan sudah dikirim ke. Note that you can change the text contains in the email alert too. Perlu diketahui bahwa Anda dapat mengubah teks dalam email berisi peringatan juga. 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. Teks pertama dimulai dengan ALERT email ditulis sebagai tubuh, dan Anda dapat menambahkan informasi lain seperti nama host atau mengubah wordings. The second Alert is the email title which you can change to your own too. Tanda yang kedua adalah judul email yang dapat mengubah Anda sendiri juga.
Now logout and login again as root, you should receive an email alert at your inbox. Sekarang logout dan login kembali sebagai root, anda akan menerima email peringatan di kotak masuk. The security trick should works on most popular flavor of Linux such as RedHat, CentOS, Ubuntu, FreeBSD and etc. Trik keamanan harus bekerja pada rasa yang paling populer seperti RedHat Linux, CentOS, Ubuntu, FreeBSD dan lain-lain
IMPORTANT : The page is machine translated and provided "as is" without warranty. PENTING: Halaman yang diterjemahkan mesin dan diberikan "sebagaimana adanya" tanpa jaminan. Machine translation may be difficult to understand. Mesin terjemahan mungkin sulit dimengerti. Please refer to Silakan merujuk ke original English article artikel asli Inggris whenever possible. bila memungkinkan.
Related Articles Artikel Terkait
- Disable Direct Root Login and User Access via SSH to Server Nonaktifkan langsung Root Pengguna Login dan akses ke server melalui SSH
- Reset the Root Password of MySQL Server Reset Password Root di MySQL Server
- Sign Up as @Gmail.com Instead Of @GoogleMail.com As Email Address and Login Daftar Sebagai as@Gmail.com Sebaliknya Of@GoogleMail.com dan Alamat Email Login
- How to Send an Email (Mail Message) from Linux Command Line Shell Cara Kirim Email (Mail Pesan) dari Linux Shell Command Line
- How to Disable Linux and Unix Cron Jobs (Crontab) Email Sending Cara Nonaktifkan Linux dan Unix Cron Jobs (crontab) Mengirim Email
- Reveal and Recover Windows NT, 2000, XP, 2003 and Longhorn Login (including Administrator) Username and Password with Login Recovery Recover mengungkapkan dan Windows NT, 2000, XP, dan 2003 Longhorn Login (termasuk administrator) dengan Username dan Password Login Pemulihan
- Disable and Turn Off Telnet in Linux Nonaktifkan dan Nonaktifkan Telnet di Linux
- Change and Reset MySQL root Password Mengubah dan Reset MySQL root Password
- How to Check Memory Usage in Linux based Server Bagaimana Periksa penggunaan memori di server berbasis Linux
- How to Change or Spoof MAC Address in Windows XP, Vista, Server 2003/2008, Mac OS X, Unix and Linux Ubah cara atau spoof MAC Address pada Windows XP, Vista, Server 2003/2008, Mac OS X, Unix dan Linux










































November 21st, 2008 03:41 November 21, 2008 03:41
Great stuff, Great stuff,
Is there a way to have the IP of the person who logs in show up? Apakah ada cara untuk mendapatkan IP dari orang yang muncul dalam log?
November 1st, 2008 03:06 November 1, 2008 03:06
This works for root login or su – from a user login. Ini berfungsi untuk login root atau su - dari pengguna login.
How can I implement it that will work also for “su” only? Bagaimana saya dapat menerapkannya yang juga akan bekerja untuk "su" saja? 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. Sekarang sejak path akan berubah, bukan dengan su su - ia tidak akan mengirim email jika seseorang tidak menggunakan "-" setelah su. Thanks. Terima kasih.
May 3rd, 2008 05:43 3 Mei 2008 05:43
'who -m' makes the output much cleaner when using this on a system that has multiple users logged on… 'yang-m' membuat banyak output bersih ini pada saat menggunakan sistem yang memiliki beberapa pengguna login di ...
-m reports only hostname and user associated with stdin terminal m-laporan hanya host dan user yang berhubungan dengan terminal stdin
August 12th, 2007 03:10 12 Agust 2007 03:10
[...] Linux – wysyłanie maila o logowaniu na konto roota Bardzo użyteczny skrypcik [...] [...] Linux - wysyłanie maila o logowaniu na konto roota Bardzo użyteczny skrypcik [...]