修改/etc/motd不生效解决办法

转自 http://blog.sina.com.cn/s/blog_63f3c0b20102wo42.html
ubuntu 与别的linux不同,直接修改/etc/motd文件重登录后无效。因为这里/etc/motd是一个符号链接,指向/var/run/motd,应该 是一个启动后在生成的文件。在版本12.04中,找到生成的脚本在目录/etc/update-motd.d/中,修改00-headerr,10-help-text的printf部分可是实现
修改后用:sudo run-parts /etc/update-motd.d 去执行就会立即见到效果,而不用反复注销登录。

逐条注释 ``` if grep -q "chroot_list_file=/etc/vsftpd/chroot_list" /etc/vsftpd/vsftpd.conf then sed -i '/chroot_list_file=/etc/vsftpd/chroot_list/s/^/#/' /etc/vsftpd/vsftpd.conf echo 'chroot_list_file=/etc/vsftpd/chroot_list' >> /etc/vsftpd/vsftpd.conf else echo 'chroot_list_file=/etc/vsftpd/chroot_list' >> /etc/vsftpd/vsftpd.conf fi if grep -q "anonymous_enable" /etc/vsftpd/vsftpd.conf then sed -i '/anonymous_enable=YES/s/^/#/' /etc/vsftpd/vsftpd.conf sed -i '/anonymous_enable=NO/s/^/#/' /etc/vsftpd/vsftpd.conf echo 'anonymous_enable=NO' >> /etc/vsftpd/vsftpd.conf else echo 'anonymous_enable=NO' >> /etc/vsftpd/vsftpd.conf fi fi touch /etc/vsftpd/chroot_list chmod 750 /etc/vsftpd/chroot_list service vsftpd restart systemctl restart vsftpd.service mv /etc/issue /etc/issue.bak mv /etc/issue.net /etc/issue.net.bak touch /etc/motd chmod 644 /etc/motd rpm -e telnet-server systemctl stop telnet.socket if grep -q "Authorized only. All activity will be monitored and reported" /etc/motd then echo 'have' else echo "Authorized only. All activity will be monitored and reported" >> /etc/motd fi if [ -f "/etc/syslog.conf" ];then echo 'authpriv.* /var/log/secure' >> /etc/syslog.conf echo 'cron.*' >> /etc/syslog.conf echo '*.* @133.64.93.31' >> /etc/syslog.conf service syslog restart fi if [ -f "/etc/rsyslog.conf" ];then echo 'authpriv.* /var/log/secure' >> /etc/rsyslog.conf echo 'cron.*' >> /etc/rsyslog.conf echo '*.* @133.64.97.31' >> /etc/rsyslog.conf service rsyslog restart systemctl restart rsyslog.service fi echo 'ok' ```
07-20
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值