• 请不要在回答技术问题时复制粘贴 AI 生成的内容
abcfreedom
V2EX  ›  程序员

如何覆盖/etc/hosts 里面的配置

  •  
  •   abcfreedom · Oct 24, 2024 · 1929 views
    This topic created in 594 days ago, the information mentioned may be changed or developed.

    公司 mac 系统的 oa 软件默认给/etc/hosts 里面写了很多规则,比如把 notion.so 指向 127.0.0.1

    有没有什么办法能覆盖这个规则,我用圈 x 开全局,也还是会指向 127.0.0.1

    youdoit
        1
    youdoit  
       Oct 24, 2024
    有权限就自己写个脚本,定时覆盖.
    abcfreedom
        2
    abcfreedom  
    OP
       Oct 24, 2024
    @youdoit #1 😂还有别的路子吗,不知道公司会不会监控修改/etc/hosts 文件
    gitnot
        3
    gitnot  
       Oct 24, 2024
    SwitchHosts
    esee
        4
    esee  
       Oct 24, 2024
    系统只是默认读取 /etc/hosts 文件,可以在配置文件中 指定额外多几个 解析文件 的
    Kinnice
        5
    Kinnice  
       Oct 24, 2024
    clash 系的代理软件,可以选择不使用 hosts
    abcfreedom
        6
    abcfreedom  
    OP
       Oct 24, 2024
    @Kinnice #5 这么强吗 我试试,Mac 是用 clashx 吗
    abcfreedom
        7
    abcfreedom  
    OP
       Oct 24, 2024
    @esee #4 在哪个配置文件呀 大佬可以详细指导下吗
    Jianrry
        8
    Jianrry  
       Oct 24, 2024 via iPhone
    换一种思路:取消 /etc/hosts 文件的可读权限,软件无法读取内容,相当于这个文件没有生效。
    SenLief
        9
    SenLief  
       Oct 24, 2024
    很多代理工具是不读取系统 hosts 的
    abcfreedom
        10
    abcfreedom  
    OP
       Oct 24, 2024
    @Jianrry #8 太机智了 一会儿试试
    abcfreedom
        12
    abcfreedom  
    OP
       Oct 24, 2024
    @arfaWong #11 感谢大佬
    abcfreedom
        13
    abcfreedom  
    OP
       Oct 24, 2024
    @Jianrry #8 感谢大佬,亲测好用,太机智了
    otakustay
        14
    otakustay  
       Oct 24, 2024
    公司这么干,就是公司政策要控制你的网络访问。你去覆盖它,先考虑下政策上是不是红线,回头会不会让你滚了不给 N+1
    abcfreedom
        15
    abcfreedom  
    OP
       Oct 24, 2024
    @otakustay #14 有道理。。我去学习一下公司政策
    studyingss
        16
    studyingss  
       Oct 24, 2024
    所以说这就是很多技术人的脑回路。。。notion.so 写 127.0.0.1 那么明显直白的屏蔽策略,你居然想的是怎么绕开。。。

    有保密要求的公司在线笔记应用一般都是禁止的,你们没入职培训吗?
    jenson47
        17
    jenson47  
       Oct 24, 2024
    装个虚拟机就可以了
    swLoXtOtd89pGg8t
        18
    swLoXtOtd89pGg8t  
       Oct 24, 2024
    @Jianrry #8
    @abcfreedom #10

    linux 中许多软件需要认 hostname 的,不允许读 hosts 会出问题。至于 op 的 macos 不清楚咩
    esee
        19
    esee  
       Oct 24, 2024 via Android
    @abcfreedom 具体 etc 下有一个叫什么 switch 的配置文件,指定了本机 dns 可以从文件中读取,默认是 hosts ,你可以自定义,具体问 ai 吧
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5504 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 533ms · UTC 06:43 · PVG 14:43 · LAX 23:43 · JFK 02:43
    ♥ Do have faith in what you're doing.