Raw sockets need root priviliege

后端 未结 3 2073
轮回少年
轮回少年 2020-12-18 08:27

Why do we need root privileges when we use raw sockets ?

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-18 08:45

    In short raw sockets is restricted to root because if it otherwise it would break other rules for networking that are in place.

    A long standing rule is that you cannot bind on a port lower than 1024 without root's blessing. With raw sockets you can simulate a server on any port. (naturally being able to receive on this port is a different story you'd also have to sniff the network, but perhaps this could be done with a different machine.)

提交回复
热议问题