我知道您可以通过在PrintLastLog no和PrintMotd no中启动SSH会话时禁用上次登录消息和当天消息/etc/ssh/sshd_config。
但是,我无权/etc/ssh/sshd_config在正在访问的系统中进行修改。有没有一种方法来设置PrintLastLog no,并PrintMotd no仅用于我的本地用户?
我知道您可以通过在PrintLastLog no和PrintMotd no中启动SSH会话时禁用上次登录消息和当天消息/etc/ssh/sshd_config。
但是,我无权/etc/ssh/sshd_config在正在访问的系统中进行修改。有没有一种方法来设置PrintLastLog no,并PrintMotd no仅用于我的本地用户?
Answers:
是的,可以,将Match User指令添加到您的sshd_config文件中,如下所示:
Match User root
PrintlastLog no
PrintMotd no
该Match指令还可以追溯Group和Address匹配GEOS / Unix组和IP地址。
更新:
作为每个用户的基础,而没有访问sshd_config的权限,您只需创建一个空文件,即可$HOME/.hushlogin防止bash在交互模式下输出这些警报。这在使用login(1)telnet和屏幕会话的其他系统下也适用。
更新2:
要Banner在每个会话的基础上抑制sshd 的输出,请使用ssh -q <host>或包含LogLevel quiet在您的〜/ .ssh / config中
~/.hushlogin取消了motd和上次登录消息。:d奖励积分,如果你可以禁用所界定的旗帜Banner /etc/issue在/etc/ssh/sshd_config。
并非所有的OpenSSH实现那些在Ubuntu允许PrintMotd或PrintlastLog在满足用户部分。
如果某人遇到以下错误,可能会发现此askubuntu问题很有用,并提供了一些解决方法:
/etc/ssh/sshd_config line 97: Directive 'PrintMotd' is not allowed within a Match block