linux 停用用户,linux – 如何禁用用户的网络访问?
发布日期:2021-06-24 11:22:22 浏览次数:2 分类:技术文章

本文共 1517 字,大约阅读时间需要 5 分钟。

尝试禁用用户的网络访问:

[root@notebook ~]# iptables -I OUTPUT -m owner --uid-owner tempuser -j DROP

[root@notebook ~]# ip6tables -I OUTPUT -m owner --uid-owner tempuser -j DROP

Could not open socket to kernel: Address family not supported by protocol

[root@notebook ~]#

[root@notebook ~]# iptables -I INPUT -m owner --uid-owner tempuser -j DROP

iptables: Invalid argument. Run `dmesg' for more information.

[root@notebook ~]# ip6tables -I INPUT -m owner --uid-owner tempuser -j DROP

Could not open socket to kernel: Address family not supported by protocol

[root@notebook ~]#

测试它:

[root@notebook ~]# su - tempuser

[tempuser@notebook ~]$ping google.com

ping: unknown host google.com

[tempuser@notebook ~]$

[tempuser@notebook ~]$ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

64 bytes from 8.8.8.8: icmp_seq=1 ttl=56 time=4.80 ms

64 bytes from 8.8.8.8: icmp_seq=2 ttl=56 time=4.07 ms

^C

--- 8.8.8.8 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1057ms

rtt min/avg/max/mdev = 4.071/4.439/4.807/0.368 ms

[tempuser@notebook ~]$

[tempuser@notebook ~]$exit

logout

[root@notebook ~]# ping google.com

PING google.com (216.58.209.174) 56(84) bytes of data.

64 bytes from bud02s21-in-f14.1e100.net (216.58.209.174): icmp_seq=1 ttl=55 time=5.05 ms

^C

--- google.com ping statistics ---

1 packets transmitted, 1 received, 0% packet loss, time 572ms

rtt min/avg/max/mdev = 5.059/5.059/5.059/0.000 ms

[root@notebook ~]#

问题:如何在Linux下禁用给定用户的网络访问? (INPUT / OUTPUT / IPv4 / IPv6?) – 为什么我仍然可以与用户ping IPv4地址?

转载地址:https://blog.csdn.net/weixin_32467749/article/details/116577188 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:linux服务器 缓存,Linux服务器内存使用分析及内存缓存
下一篇:linux磁盘的命令是,linux磁盘相关的命令

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月15日 20时41分18秒