linux /etc/motd,Linux の /etc/issue & /etc/motd

本文介绍CentOS系统中6个控制台的切换方法及/etc/issue和/etc/motd文件的用途。通过这些文件可以配置系统登录前显示的信息,如硬件配置和系统维护通知等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/etc/issue

Centos有6个控制台,这就好比一个房子有6个门,随便哪一扇都能进入,可以通过Ctrl+Alt+(F1~F6)进行切换。

我们随意切换控制台,会发现如下信息

1937800fd9f5ddc3c27ed5a421b9c751.png

标红部分就是登录系统前的信息,这个一般书写一些系统的硬件配置信息,可以在/etc/issue中进行配置,具体我们可以通过 man issue 来查看

\d     insert current day (localtime),

\l     insert line on which mingetty is running,

\m     inserts machine architecture (uname -m),

\n     inserts machine’s network node hostname (uname -n),

\o     inserts domain name,

\r     inserts operating system release (uname -r),

\t     insert current time (localtime),

\s     inserts operating system name,

\u     resp.  \U  the  current  number  of  users  which are currently logged in.  \U inserts "n

users", where as \u only inserts "n".

\v     inserts operating system version (uname -v).

/etc/motd

motd = message of the today

The  contents of /etc/motd are displayed by login(1) after a successful login but just before it executes the login shell.

在登录成功之后显示的消息,常常通过这个来通知一些服务器的通知,比如xxx时间服务器关闭进行数据同步、系统维护等等

# /etc/motd

Hello everyone, welcome to www.jld.com

Our server will be maintained at 2015/01/20 0:00 ~ 24:00

0f14519e1d223f149fb56fb40b611a4e.png

逐条注释 ``` 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值