mac 10.14.6 下, ping 没权限啊?

2019-09-16 12:27:29 +08:00
 PbCopy111

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

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/openssl@1.1/bin:$PATH"
export PATH="/usr/local/opt/nss/bin:$PATH"
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi

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

3309 次点击
所在节点    问与答
4 条回复
ysc3839
2019-09-16 12:32:32 +08:00
ping: Lacking privilege for raw socket.
ping 已经告诉你问题出在哪了。
pupboss
2019-09-16 12:49:15 +08:00
inetutils 那行干掉就好了
PbCopy111
2019-09-16 14:09:48 +08:00
@pupboss #2 搞定了,谢谢!
PbCopy111
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 之类的命令。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/601119

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX