netstat 命令看不到 PID/Program Name 的原因---非root用户

 

参考链接:https://access.redhat.com/solutions/394093
Why does netstat not show the process PID/Program Name in RHEL

[root@abc ~]# netstat -plnt | head -5
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:5899                0.0.0.0:*                   LISTEN      4877/postgres       
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1644/rpcbind        
tcp        0      0 0.0.0.0:63124               0.0.0.0:*                   LISTEN      1701/rpc.statd      
[root@abc ~]# netstat -tulp | head -5
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 *:5899                      *:*                         LISTEN      4877/postgres   --->>>能看到所有user的 PID/Program name   tcp        0      0 *:sunrpc                    *:*                         LISTEN      1644/rpcbind        
tcp        0      0 *:63124                     *:*                         LISTEN      1701/rpc.statd    
  
[root@abc ~]# su - highgo475  ---->>>切换到highgo475用户
[highgo475@abc ~]$ netstat -tulp | head -5
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 *:5899                      *:*                         LISTEN      4877/postgres  --->>>只能看到本user的 PID/Program name 
tcp        0      0 *:sunrpc                    *:*                         LISTEN      -                   
tcp        0      0 *:63124                     *:*                         LISTEN      -                   
[highgo475@abc ~]$ exit

[root@abc ~]# su - highgo432  ---->>>切换到highgo432用户

[highgo432@abc ~]$ netstat -tulp | head -5
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 *:5899                      *:*                         LISTEN      -                 --->>>注意此处。    
tcp        0      0 *:sunrpc                    *:*                         LISTEN      -                   
tcp        0      0 *:63124                     *:*                         LISTEN      -                   
[highgo432@abc ~]$ 

 

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值