V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
PbCopy111
V2EX  ›  问与答

mac 10.14.6 下, ping 没权限啊?

  •  1
     
  •   PbCopy111 · 2019-09-16 12:27:29 +08:00 · 3295 次点击
    这是一个创建于 1894 天前的主题,其中的信息可能已经有所发展或是发生改变。

    突然发现这个问题,不知道问题出在哪里。

    ls -l /usr/local/bin |grep ping  
    lrwxr-xr-x  1 pcpc  admin       31  8 31 08:46 nping -> ../Cellar/nmap/7.80_1/bin/nping
    -rwsr-xr-x  1 pcpc  admin    41968  9 16 11:25 ping
    lrwxr-xr-x  1 pcpc  admin       33 11 18  2018 tcping -> ../Cellar/tcping/1.3.5/bin/tcping
    
    MacBOOK:bin pcpc$ which ping
    /usr/local/opt/inetutils/libexec/gnubin/ping
    
    MacBOOK:/ pcpc$ ping baidu.com  
    ping: Lacking privilege for raw socket.  
    MacBOOK:/ pcpc$ traceroute 223.5.5.5  
    traceroute to 223.5.5.5 (223.5.5.5), 64 hops max  
    traceroute: socket: Operation not permitted   
    
    MacBOOK:sbin pcpc$ groups
    staff everyone localaccounts _appserverusr admin _appserveradm _lpadmin com.apple.sharepoint.group.3 com.apple.sharepoint.group.2 _appstore _lpoperator _developer _analyticsusers com.apple.access_ftp com.apple.access_screensharing com.apple.access_ssh com.apple.sharepoint.group.1
    

    vi ~/.bash_profile

    export CLICOLOR=1
    export PYENV_ROOT="${HOME}/.pyenv"
    if [ -d "${PYENV_ROOT}" ]; then
      export PATH="${PYENV_ROOT}/bin:${PATH}"
      eval "$(pyenv init -)"
     #eval "$(thefuck --alias fuck)"
    fi
    archey
    
    #if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
    
    export PATH="/usr/local/opt/sqlite/bin:$PATH"
    export PATH="/usr/local/opt/inetutils/libexec/gnubin:$PATH"
    
    
    
    export PATH=$PATH:/usr/local/sbin
    export LDFLAGS="-L/usr/local/opt/zlib/lib"
    export CPPFLAGS="-I/usr/local/opt/zlib/include"
    
    export PATH="/usr/local/opt/icu4c/bin:$PATH"
    export PATH="/usr/local/opt/icu4c/sbin:$PATH"
    #export PATH="$HOME/.rbenv/bin:$PATH"
    #eval "$(rbenv init -)"
    export PATH="/usr/local/opt/sqlite/bin:$PATH"
    export PATH="/usr/local/opt/[email protected]/bin:$PATH"
    export PATH="/usr/local/opt/nss/bin:$PATH"
    if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
    

    我能想到的信息就这些了,还需要什么么???

    4 条回复    2019-09-16 14:28:25 +08:00
    ysc3839
        1
    ysc3839  
       2019-09-16 12:32:32 +08:00 via Android
    ping: Lacking privilege for raw socket.
    ping 已经告诉你问题出在哪了。
    pupboss
        2
    pupboss  
       2019-09-16 12:49:15 +08:00 via iPhone
    inetutils 那行干掉就好了
    PbCopy111
        3
    PbCopy111  
    OP
       2019-09-16 14:09:48 +08:00
    @pupboss #2 搞定了,谢谢!
    PbCopy111
        4
    PbCopy111  
    OP
       2019-09-16 14:28:25 +08:00
    我知道了,因为我需要 ftp 工具,所以通过 brew 安装了工具包:

    `brew install inetutils`

    安装以后需要设置 path,所以才有了`export PATH="/usr/local/opt/inetutils/libexec/gnubin:$PATH"`这行。 可惜这样会导致 ping 之类的命令都无权限。

    所以应该在 install 以后继续运行`brew link --overwrite inetutils`,这样才可以正常使用 ftp 之类的命令。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2299 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 16:01 · PVG 00:01 · LAX 08:01 · JFK 11:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.