Linux 系统中的 /etc/issue and /etc/issue.net 文件

Linux 系统中的 /etc/issue and /etc/issue.net 文件

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.1
 Ubuntu 20.04.5 LTS
 yongqiang@192.168.0.1’s password:
 

References

[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yongqiang Cheng

梦想不是浮躁,而是沉淀和积累。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值