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

/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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是将这些命令转换为Python代码的示例: ```python import subprocess chroot_list_file = '/etc/vsftpd/chroot_list' motd_file = '/etc/motd' syslog_conf_file = '/etc/syslog.conf' # Create and set permissions for chroot_list file subprocess.call('touch /etc/vsftpd/chroot_list', shell=True) subprocess.call('chmod 750 /etc/vsftpd/chroot_list', shell=True) # Restart vsftpd service subprocess.call('service vsftpd restart', shell=True) subprocess.call('systemctl restart vsftpd.service', shell=True) # Backup and create issue, issue.net, and motd files subprocess.call('mv /etc/issue /etc/issue.bak', shell=True) subprocess.call('mv /etc/issue.net /etc/issue.net.bak', shell=True) subprocess.call('touch /etc/motd', shell=True) subprocess.call('chmod 644 /etc/motd', shell=True) # Remove telnet-server package and stop telnet.socket service subprocess.call('rpm -e telnet-server', shell=True) subprocess.call('systemctl stop telnet.socket', shell=True) # Update motd file if subprocess.call('grep -q "Authorized only. All activity will be monitored and reported" /etc/motd', shell=True) != 0: subprocess.call('echo "Authorized only. All activity will be monitored and reported" >> /etc/motd', shell=True) # Update syslog.conf file if subprocess.call('[ -f "/etc/syslog.conf" ]', shell=True) == 0: subprocess.call('echo "authpriv.* /var/log/secure" >> /etc/syslog.conf', shell=True) subprocess.call('echo "cron.*" >> /etc/syslog.conf', shell=True) subprocess.call('*.* @133.64.93.31' >> /etc/syslog.conf', shell=True) subprocess.call('service syslog restart', shell=True) ``` 上述代码首先创建`/etc/vsftpd/chroot_list`文件,并设置其权限为750。 然后,通过执行`service vsftpd restart`和`systemctl restart vsftpd.service`命令来重新启动vsftpd服务。 接下来,备份并创建`/etc/issue`、`/etc/issue.net`和`/etc/motd`文件,并设置权限。 然后,通过执行`rpm -e telnet-server`命令来删除`telnet-server`软件包,并通过执行`systemctl stop telnet.socket`命令来停止`telnet.socket`服务。 接着,检查是否在`/etc/motd`文件中存在特定的内容。如果不存在,则在文件末尾添加一行内容。 最后,检查是否存在`/etc/syslog.conf`文件。如果文件存在,则在文件末尾添加几行配置,并通过执行`service syslog restart`命令来重启syslog服务。 请确保你具有足够的权限来执行这些操作,并将需要修改的文件路径正确添加到相应的变量中。运行代码后,命令将被执行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值