• linux hosts.equiv设置解析


    hosts.equiv文件的用途与格式


      一、 hosts.equiv 文件的用途

      /etc/hosts.equiv 和 $HOME/.rhosts 定义了哪些计算机和用户可以不用提供口令就在本地计算机上执行远程命令,如 rexec,rcp,rlogin 等等。这些不需要提供口令的计算机和用户称为受信任的。

      当本地计算机收到执行远程命令的请求时,相应的远程命令服务进程,如 rlogind ,首先检查 /etc/hosts.equiv 来确认请求是否来自受信任的计算机和用户。如果这个文件不存在或者虽然存在但不包括相应的计算机和用户,服务进程就会去检查 $HOME/.rhosts 文件。

      /etc/hosts.equiv 的权限必须设置为只有 root 能够写,建议权限为600。如果这个文件被设置为同组或其它用户可写,远程命令服务进程就会忽略它的存在。

      如果远程命令是由 root 用户发起的,远程命令服务进程会忽略 /etc/hosts.equiv 文件的存在而去直接检查 $HOME/.rhosts 文件。

      在指定受信任的计算机和用户时要非常小心,因为这有可能会造成安全漏洞。

      二、 hosts.equiv 文件的格式

      添加对计算机/用户的信任:

      hostname:信任计算机 hostname 上的所有普通用户

      hostname username:信任计算机 hostname 上的用户 username

      +:信任所有计算机上的所有普通用户

      禁止对计算机/用户的信任:

      如果计算机名和用户都没有在 /etc/hosts.equiv 中被定义为受信任的,那么它们就是不受信任的。另外,您还可以用以下方法明确地禁止对计算机/用户的信任。

      -hostname:不信任计算机 hostname 上的所有用户

      hostname -username: 不信任计算机 hostname 上的用户 username

      hosts.equiv 与 NIS :

      在 /etc/hosts.equiv 中也可以指定是否信任 NIS 网络组(NETGROUP)。

      +@netgroup:信任网络组 netgroup 中的所有计算机

      -@netgroup:禁止信任网络组 netgroup 中的所有计算机

      hostname +@netgroup:信任来自计算机 hostname 的所有网络组 netgroup 的成员用户的请求

      hostname -@netgroup:禁止信任来自计算机 hostname 的所有网络组 netgroup 的成员用户的请求

      /etc/hosts.equiv 中记录的顺序:

      在 /etc/hosts.equiv 文件中,记录的顺序十分重要。远程命令服务进程在检查 /etc/hosts.equiv 文件时会在第一个匹配发现后返回,也就是说,下面这个例子中的禁止信任记录是不起作用的:

    hostname
    hostname -user1

      计算机 hostname 上的用户 user1 将能够在不提供口令的情况下在本地计算机上执行远程命令。而下面这个例子能够提供期望中的结果:

    hostname -user1
    hostname

      三、/etc/hosts.equiv示例

      1. 允许远程计算机 emerald 和 amethyst 上的所有用户在本地执行远程命令而无须提供口令:

    emerald
    amethyst

      2. 允许远程计算机 emerald 上的所有用户和 amethyst 上的用户 greygory 在本地执行远程命令而无须提供口令:

    emerald
    amethyst gregory

      3. 允许用户 peter 从任何远程计算机在本地执行远程命令而无须提供口令:

    emerald
    amethyst gregory
    + peter

      4. 允许所有是 century 网络组成员的远程计算机上的所有用户在本地执行远程命令而无须提供口令:

    emerald
    amethyst gregory
    + peter
    +@century

      5. 允许所有在计算机 citrine 上又是 engineers 网络组成员的用户在本地执行远程命令而无须提供口令:

    emerald
    amethyst gregory
    + peter
    +@century
    citrine +@engineers

      6. 允许所有是 servers 网络组成员的远程计算机上的所有属于 sysadmins 网络组的用户在本地执行远程命令而无须提供口令:

    emerald
    amethyst gregory
    + peter
    +@century
    citrine +@engineers
    +@server
    +@sysadmins
     
     
  • 相关阅读:
    virtualBox下面安装linux系统如何共享目录
    PHP中spl_autoload_register()函数
    PHP 5.5 新特性
    useradd密码无效
    Linux audit安全审计工具
    Javascript class获取回调函数数据
    RPi 3B 无线连接配置
    Refused to execute inline event handler because it violates the following Content Security Policy directive: "xxx". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...')
    options.html:1 Refused to load the script 'xxxx' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:".
    jQuery.Deferred exception: $.get is not a function TypeError: $.get is not a function
  • 原文地址:https://www.cnblogs.com/xuaijun/p/8608122.html
Copyright © 2020-2023  润新知