Linux 系统中的 /etc/issue and /etc/issue.net 文件
- 1. `/etc/issue` and `/etc/issue.net`
- 2. `/etc/ssh/sshd_config`
- References
1. /etc/issue
and /etc/issue.net
(base) yongqiang@yongqiang:~$ cat /etc/issue
Ubuntu 20.04.5 LTS \n \l(base) yongqiang@yongqiang:~$
(base) yongqiang@yongqiang:~$ cat /etc/issue.net
Ubuntu 20.04.5 LTS
(base) yongqiang@yongqiang:~$
(base) yongqiang@yongqiang:~$ man issue
- prelogin message and identification file
/etc/issue
is a text file which contains a message or system identification to be printed before the login prompt. It may contain various @char
and \char
sequences, if supported by the getty-type program employed on the system.
/etc/issue.net
是一个文本文件,它包含了在登录提示符出现之前显示的信息或者系统标识。
The following sequences are supported by telnetd:
%t
- show the current tty
%h
- show the system node name (FQDN)
%D
- show the name of the NIS domain
%d
- show the current time and date
%s
- show the name of the operating system (操作系统的名称)
%m
- show the machine (hardware) type
%r
- show the operating system release
%v
- show the operating system version (操作系统的版本)
%%
- display a single '%' character
Run the following commands to set permissions on /etc/issue.net
:
# chown root:root /etc/issue.net
# chmod u-x,go-wx /etc/issue.net
2. /etc/ssh/sshd_config
取消 /etc/ssh/sshd_config
文件中 Banner /etc/issue.net
的注释,/etc/issue.net
文件才能生效。
/etc/issue.net
只会输出原始字符,不支持转义符号。
(base) yongqiang@yongqiang:~$ cat /etc/ssh/sshd_config
...# Default banner path
#Banner /etc/issue.net...
(base) yongqiang@yongqiang:~$
The /etc/issue
file is normally used to display a login message or banner.
$ ssh yongqiang@192.168.0.1Ubuntu 20.04.5 LTSyongqiang@192.168.0.1’s password:
References
[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/