参考链接: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 ~]$ 

 

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐