{"id":2221,"date":"2025-09-02T11:55:45","date_gmt":"2025-09-02T11:55:45","guid":{"rendered":"https:\/\/remote-support.space\/wordpress\/?p=2221"},"modified":"2025-09-02T11:55:45","modified_gmt":"2025-09-02T11:55:45","slug":"error-cannot-ping-from-normal-user","status":"publish","type":"post","link":"http:\/\/remote-support.space\/wordpress\/2025\/09\/02\/error-cannot-ping-from-normal-user\/","title":{"rendered":"Error cannot ping from normal user"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>File \/etc\/hosts saved<br \/>\nkhawar@mx:~<br \/>\n$ ping isv.remote-support.space<br \/>\nping: socktype: SOCK_RAW<br \/>\nping: socket: Operation not permitted<br \/>\nping: =&gt; missing cap_net_raw+p capability or setuid?<br \/>\nkhawar@mx:~<br \/>\n$ sudo setcap cap_net_raw+ep \/bin\/ping<br \/>\n[sudo] password for khawar:<br \/>\nkhawar@mx:~<br \/>\n$ ping isv.remote-support.space<br \/>\nPING isv.remote-support.space (10.8.0.102) 56(84) bytes of data.<br \/>\n^C<br \/>\n&#8212; isv.remote-support.space ping statistics &#8212;<br \/>\n1 packets transmitted, 0 received, 100% packet loss, time 0ms<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<p data-spm-anchor-id=\"a2ty_o01.29997173.0.i2.3bc1c921xxtA50\">The error you&#8217;re seeing:<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-2\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-gutters cm-gutters-before\" aria-hidden=\"true\">\n<div class=\"cm-gutter cm-foldGutter\">\n<div class=\"cm-gutterElement cm-activeLineGutter\"><\/div>\n<\/div>\n<\/div>\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\">\n<div class=\"cm-activeLine cm-line\">ping isv.remote-support.space<\/div>\n<div class=\"cm-line\">ping: socktype: SOCK_RAW<\/div>\n<div class=\"cm-line\">ping: socket: Operation not permitted<\/div>\n<div class=\"cm-line\">ping: =&gt; missing cap_net_raw+p capability or setuid?<\/div>\n<\/div>\n<div class=\"cm-layer cm-layer-above cm-cursorLayer\" aria-hidden=\"true\"><\/div>\n<div class=\"cm-layer cm-selectionLayer\" aria-hidden=\"true\">indicates that the <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> command cannot create a raw socket, which it needs to send ICMP echo requests. This is typically due to missing privileges.<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"my-2\"><\/div>\n<h3>\ud83d\udd0d Why this happens<\/h3>\n<p>The <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> utility requires the ability to send and receive <strong>ICMP packets<\/strong>, which involves using <strong>raw sockets<\/strong> (<code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">SOCK_RAW<\/code>). On modern Linux systems, this capability is controlled by <strong>capabilities<\/strong>, specifically <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">CAP_NET_RAW<\/code>.<\/p>\n<div class=\"my-2\"><\/div>\n<p>There are two common reasons for this error:<\/p>\n<div class=\"my-2\"><\/div>\n<ol start=\"1\">\n<li><strong>The <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> binary lacks the <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">CAP_NET_RAW<\/code> capability.<\/strong><\/li>\n<li><strong>The <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> binary is not setuid root<\/strong> (and your user doesn&#8217;t have sufficient privileges).<\/li>\n<\/ol>\n<div class=\"my-2\"><\/div>\n<div class=\"py-2 my-3\">\n<hr \/>\n<\/div>\n<div class=\"my-2\"><\/div>\n<h3>\u2705 How to fix it<\/h3>\n<h4>\u2714\ufe0f Option 1: Add the <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">CAP_NET_RAW<\/code> capability to <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code><\/h4>\n<p>Run this command as root or with <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">sudo<\/code>:<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-bash  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-19\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-gutters cm-gutters-before\" aria-hidden=\"true\">\n<div class=\"cm-gutter cm-foldGutter\">\n<div class=\"cm-gutterElement cm-activeLineGutter\"><\/div>\n<\/div>\n<\/div>\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\" data-language=\"shell\" aria-autocomplete=\"list\">\n<div class=\"cm-activeLine cm-line\">sudo setcap cap_net_raw+ep \/bin\/ping<\/div>\n<\/div>\n<div class=\"cm-layer cm-layer-above cm-cursorLayer\" aria-hidden=\"true\"><\/div>\n<div class=\"cm-layer cm-selectionLayer\" aria-hidden=\"true\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"plt-canvas-995d18b7-92ce-4a45-adcb-fcaf858b6656-19\" class=\"scrollbar-hidden max-w-full overflow-x-auto bg-[#202123] text-white\"><\/div>\n<\/div>\n<\/div>\n<div class=\"my-2\"><\/div>\n<blockquote><p>This grants the <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> binary the capability to create raw sockets without requiring full root privileges.<\/p><\/blockquote>\n<div class=\"my-2\"><\/div>\n<p>After running this, try <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> again:<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-bash  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-25\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-gutters cm-gutters-before\" aria-hidden=\"true\">\n<div class=\"cm-gutter cm-foldGutter\">\n<div class=\"cm-gutterElement cm-activeLineGutter\"><\/div>\n<\/div>\n<\/div>\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\" data-language=\"shell\" aria-autocomplete=\"list\">\n<div class=\"cm-activeLine cm-line\">ping isv.remote-support.space<\/div>\n<\/div>\n<div class=\"cm-layer cm-layer-above cm-cursorLayer\" aria-hidden=\"true\"><\/div>\n<div class=\"cm-layer cm-selectionLayer\" aria-hidden=\"true\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"plt-canvas-995d18b7-92ce-4a45-adcb-fcaf858b6656-25\" class=\"scrollbar-hidden max-w-full overflow-x-auto bg-[#202123] text-white\"><\/div>\n<\/div>\n<\/div>\n<div class=\"my-2\"><\/div>\n<h4>\u2714\ufe0f Option 2: Use <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">sudo<\/code> when pinging<\/h4>\n<p>If you don&#8217;t want to modify capabilities, run <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> with elevated privileges:<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-bash  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-30\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-gutters cm-gutters-before\" aria-hidden=\"true\">\n<div class=\"cm-gutter cm-foldGutter\">\n<div class=\"cm-gutterElement\"><\/div>\n<\/div>\n<\/div>\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\" data-language=\"shell\" aria-autocomplete=\"list\">\n<div class=\"cm-activeLine cm-line\">sudo ping isv.remote-support.space<\/div>\n<\/div>\n<div class=\"cm-layer cm-layer-above cm-cursorLayer\" aria-hidden=\"true\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>This works because <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">sudo<\/code> gives you the necessary privileges to create raw sockets.<\/p>\n<div class=\"my-2\"><\/div>\n<div class=\"py-2 my-3\">\n<hr \/>\n<\/div>\n<div class=\"my-2\"><\/div>\n<h3>\u274c Why not setuid?<\/h3>\n<p>In older systems, <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">\/bin\/ping<\/code> was often <strong>setuid root<\/strong> (owned by root with the setuid bit set). Modern systems prefer <strong>capabilities<\/strong> instead for better security.<\/p>\n<div class=\"my-2\"><\/div>\n<p>You can check if <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> currently has capabilities:<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-bash  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-41\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-gutters cm-gutters-before\" aria-hidden=\"true\">\n<div class=\"cm-gutter cm-foldGutter\">\n<div class=\"cm-gutterElement cm-activeLineGutter\"><\/div>\n<\/div>\n<\/div>\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\" data-language=\"shell\" aria-autocomplete=\"list\">\n<div class=\"cm-activeLine cm-line\">getcap \/bin\/ping<\/div>\n<\/div>\n<div class=\"cm-layer cm-layer-above cm-cursorLayer\" aria-hidden=\"true\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Expected output (if fixed):<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-45\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-gutters cm-gutters-before\" aria-hidden=\"true\">\n<div class=\"cm-gutter cm-foldGutter\">\n<div class=\"cm-gutterElement cm-activeLineGutter\"><\/div>\n<\/div>\n<\/div>\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\">\n<div class=\"cm-activeLine cm-line\">\/bin\/ping = cap_net_raw+ep<\/div>\n<\/div>\n<div class=\"cm-layer cm-selectionLayer\" aria-hidden=\"true\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>If there&#8217;s no output, the capability is missing.<\/p>\n<div class=\"my-2\"><\/div>\n<div class=\"py-2 my-3\">\n<hr \/>\n<\/div>\n<div class=\"my-2\"><\/div>\n<h3>\u26a0\ufe0f Security Note<\/h3>\n<p>Giving <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">CAP_NET_RAW<\/code> to <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> is safe and standard on most Linux distributions. Avoid setting unnecessary privileges on other binaries.<\/p>\n<div class=\"my-2\"><\/div>\n<div class=\"py-2 my-3\">\n<hr \/>\n<\/div>\n<div class=\"my-2\"><\/div>\n<h3>\ud83d\udee0 Check if <code class=\"codespan cursor-pointer z-[9] relative\" translate=\"no\">ping<\/code> is working properly<\/h3>\n<p>After applying the fix:<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-bash  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-59\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-gutters cm-gutters-before\" aria-hidden=\"true\">\n<div class=\"cm-gutter cm-foldGutter\">\n<div class=\"cm-gutterElement cm-activeLineGutter\"><\/div>\n<\/div>\n<\/div>\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\" data-language=\"shell\" aria-autocomplete=\"list\">\n<div class=\"cm-activeLine cm-line\">ping -c <span class=\"\u037cd\">4<\/span> google.com<\/div>\n<\/div>\n<div class=\"cm-layer cm-selectionLayer\" aria-hidden=\"true\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>If it works, your issue is resolved.<\/p>\n<div class=\"my-2\"><\/div>\n<div class=\"py-2 my-3\">\n<hr \/>\n<\/div>\n<div class=\"my-2\"><\/div>\n<h3>Summary<\/h3>\n<p>Run:<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-bash  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-68\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\" data-language=\"shell\" aria-autocomplete=\"list\">\n<div class=\"cm-activeLine cm-line\">sudo setcap cap_net_raw+ep \/bin\/ping<\/div>\n<\/div>\n<div class=\"cm-layer cm-layer-above cm-cursorLayer\" aria-hidden=\"true\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Then test:<\/p>\n<div>\n<div class=\"my-[12px] code-cntainer code-cntainer-mobile\" dir=\"ltr\">\n<div class=\"language-bash  -mt-8 rounded-t-xl rounded-b-xl overflow-hidden  code-content\">\n<div id=\"code-textarea-995d18b7-92ce-4a45-adcb-fcaf858b6656-72\" class=\"code-textarea h-full w-full \" translate=\"no\">\n<div class=\"cm-editor \u037c1 \u037c2 \u037c4\">\n<div class=\"cm-scroller\" tabindex=\"-1\">\n<div class=\"cm-gutters cm-gutters-before\" aria-hidden=\"true\">\n<div class=\"cm-gutter cm-foldGutter\"><\/div>\n<\/div>\n<div class=\"cm-content\" role=\"textbox\" contenteditable=\"false\" spellcheck=\"false\" translate=\"no\" aria-multiline=\"true\" aria-placeholder=\"Enter your code here...\" data-language=\"shell\" aria-autocomplete=\"list\">\n<div class=\"cm-activeLine cm-line\">ping isv.remote-support.space<\/div>\n<\/div>\n<div class=\"cm-layer cm-layer-above cm-cursorLayer\" aria-hidden=\"true\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-spm-anchor-id=\"a2ty_o01.29997173.0.i1.3bc1c921xxtA50\">\u2705 This should resolve the &#8220;Operation not permitted&#8221; error.<\/p>\n<p data-spm-anchor-id=\"a2ty_o01.29997173.0.i1.3bc1c921xxtA50\">\n<p data-spm-anchor-id=\"a2ty_o01.29997173.0.i1.3bc1c921xxtA50\">\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; File \/etc\/hosts saved khawar@mx:~ $ ping isv.remote-support.space ping: socktype: SOCK_RAW ping: socket: Operation not permitted ping: =&gt; missing cap_net_raw+p capability or setuid? khawar@mx:~ $ sudo setcap cap_net_raw+ep \/bin\/ping [sudo] password for khawar: khawar@mx:~ $ ping isv.remote-support.space PING isv.remote-support.space (10.8.0.102) 56(84) bytes of data. ^C &#8212; isv.remote-support.space ping statistics &#8212; 1 packets transmitted, 0 received, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2221","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/posts\/2221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/comments?post=2221"}],"version-history":[{"count":1,"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/posts\/2221\/revisions"}],"predecessor-version":[{"id":2222,"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/posts\/2221\/revisions\/2222"}],"wp:attachment":[{"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/media?parent=2221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/categories?post=2221"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/remote-support.space\/wordpress\/wp-json\/wp\/v2\/tags?post=2221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}