1.使用root用户登录到你的服务器;
2.在全局源定义处配置警告(/etc/bashrc),这样就会对 root 用户以及普通用户都生效:
[root@vps ~]# vi /etc/bashrc
将下面的内容加入到上述文件的尾部。
echo 'ALERT - Root Shell Access (vps.ehowstuff.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" recipient@gmail.com
你也可以选择性地让警告只对 root 用户生效:
[root@vps ~]# vi .bashrc
将下面的内容添加到/root/.bashrc的尾部:
echo 'ALERT - Root Shell Access (vps.ehowstuff.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" recipient@gmail.com
整个配置文件样例:
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
echo 'ALERT - Root Shell Access (vps.ehowstuff.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" recipient@gmail.com
你也可以选择性地让警告只对特定的普通用户生效(例如 skytech):
[root@vps ~]# vi /home/skytech/.bashrc
将下面的内容加入到/home/skytech/.bashrc文件尾部:
echo 'ALERT - Root Shell Access (vps.ehowstuff.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" recipient@gmail.com
最新微语
最新文章
链接
最新评论
- EdwardSoype 说:
十字路口,我们分着走。你走我的泪,... - 热搜 说:
文章还不错支持一下 - 头条 说:
文章非常好超喜欢 - 新闻头条 说:
文章非常好超喜欢 - 今日头条新闻 说:
文章还不错支持一下
2015-06-30 09:27