禁用特定用户或 ip 的 ssh 横幅

禁用特定用户或 ip 的 ssh 横幅

我通过设置 it 启用了出现在密码提示之前的横幅sshd_config。然而,某些用户(尤其是我)确实不需要看到横幅(它也会搞砸很多脚本)。我希望能够为某些用户甚至某些 IP 地址禁用它。我该怎么做呢?

需要说明的是,这是通常出现的旗帜/etc/issue.net,而不是可以被压制的旗帜.hushlogin

答案1

这是一个例子。有关如何Match工作的详细信息请参见sshd_config手册页。

摘抄

Match   Introduces a conditional block.  If all of the criteria on the Match 
        line are satisfied, the keywords on the following lines override those 
        set in the global section of the config file, until either another Match 
        line or the end of the file.

        The arguments to Match are one or more criteria-pattern pairs.  The 
        available criteria are User, Group, Host, and Address.  The match 
        patterns may consist of single entries or comma-separated lists and may 
        use the wildcard and negation operators described in the PATTERNS 
        section of ssh_config(5).

有关允许的模式的详细信息,请参见ssh_config手册页的“PATTERNS”下。

摘抄

PATTERNS
        A pattern consists of zero or more non-whitespace characters, ‘*’ 
        (a wildcard that matches zero or more characters), or ‘?’ (a wildcard 
        that matches exactly one character).  For example, to specify a set of 
        declarations for any host in the “.co.uk” set of domains, the following 
        pattern could be used:

           Host *.co.uk

       The following pattern would match any host in the 192.168.0.[0-9] network 
       range:

           Host 192.168.0.?

       A pattern-list is a comma-separated list of patterns.  Patterns within 
       pattern-lists may be negated by preceding them with an exclamation mark 
       (‘!’).  For example, to allow a key to be used from anywhere within an 
       organisation except from the “dialup” pool, the following entry (in 
       authorized_keys) could be used:

          from="!*.dialup.example.com,*.example.com"

例子

Match User user1,user2
  Banner "none"

答案2

使用符合适当条件的一节或多Match节,并将其中的选项设置为。sshd_configBannernone

相关内容