{"id":952,"date":"2012-08-03T09:51:07","date_gmt":"2012-08-03T01:51:07","guid":{"rendered":"http:\/\/rmohan.com\/?p=952"},"modified":"2012-08-03T09:51:07","modified_gmt":"2012-08-03T01:51:07","slug":"e-mail-alert-on-root-ssh-login","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=952","title":{"rendered":"E-mail Alert on Root SSH Login"},"content":{"rendered":"<h1>E-mail Alert on Root SSH Login<\/h1>\n<p>Want to be notified instantly when someone logs into your server as root? No problem, check out this nice tutorial on email notification for root logins. Keeping track of who logs into your server and when is very important, especially when you\u2019re dealing with the super user account. We recommend that you use an email address not hosted on the server your sending the alert from.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>So lets get started!<\/strong><\/p>\n<p><strong>1.<\/strong> Login to your server and su to root, I know the irony!<\/p>\n<p><strong>2.<\/strong> <em>cd \/root<\/em><\/p>\n<p><strong>3.<\/strong> <em>pico .bashrc<\/em><\/p>\n<p><strong>4.<\/strong> Scroll to the end of the file then add the following:<br \/>\n<em>echo \u2018ALERT \u2013 Root Shell Access (YourserverName) on:\u2019 `date` `who` | mail -s \u201cAlert: Root Access from `who | cut -d\u201d(\u201d -f2 | cut -d\u201d)\u201d -f1`\u201d <\/em><a href=\"mailto:you@yourdomain.com\"><em>you@yourdomain.com<\/em><\/a><\/p>\n<p>Replace <em>YourServerName <\/em>with the handle for your actual server<br \/>\nReplace <a href=\"mailto:you@yourdomain.com\"><em>you@yourdomain.com<\/em><\/a> with your actual email address<\/p>\n","protected":false},"excerpt":{"rendered":"<p>E-mail Alert on Root SSH Login <\/p>\n<p>Want to be notified instantly when someone logs into your server as root? No problem, check out this nice tutorial on email notification for root logins. Keeping track of who logs into your server and when is very important, especially when you\u2019re dealing with the super user account. We [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/952"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=952"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/952\/revisions"}],"predecessor-version":[{"id":953,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/952\/revisions\/953"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}