mac本来自己的account 是有最高权限的,但实际一些命令还需要转成root 才能正确执行,比如lsof -i 这类查看设备进程和端口的命令,就需要root 才能正确执行。
原因是linux系统中被设置成root权限的并不等于是和root同等权限。
xxxxxx@xxxnoMacBook-Pro tinyphp % sudo /bin/bash
Password:
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2# lsof -nP -i TCP:80 | grep LISTEN
httpd 136 root 4u IPv6 0x504faff83a7aa681 0t0 TCP *:80 (LISTEN)
httpd 399 _www 4u IPv6 0x504faff83a7aa681 0t0 TCP *:80 (LISTEN)
httpd 7304 _www 4u IPv6 0x504faff83a7aa681 0t0 TCP *:80 (LISTEN)
httpd 7307 _www 4u IPv6 0x504faff83a7aa681 0t0 TCP *:80 (LISTEN)
httpd 7308 _www 4u IPv6 0x504faff83a7aa681 0t0 TCP *:80 (LISTEN)
当要回到原来的account
su -
网友评论