14

When I try to run:

ping www.google.com

I get the following error:

ping: icmp open socket: Permission denied

Running with sudo doesn't make a difference.

  • 1
    Why does the ping command require bash to be started with admin privileges? This is a known issue that has to due with differences between the way the Linux and the Windows kernel handle the ICMP request that makes ping possible. We plan to address this in future releases. msdn.microsoft.com/en-us/commandline/wsl/… – phuclv Aug 4 '16 at 16:35
23

Update: This issue has been fixed since the Windows 10 Creators Update (April 2017). Bash on Windows no longer requires administrator rights to execute the ping command.

"The Windows TCP/IP stack requires admin privileges to open RAW sockets for security measures" [source]. See MSDN post. This only applies to low-level network protocols such as ICMP used by ping.

Running your "Bash on Windows" shell as administrator should allow the ping command to work. Simply right-click it's shortcut and select the option:

Select 'run as administrator' for Bash start menu shortcut

This will only work for the single session opened with these rights.

If other commands also can't connect to the internet (e.g. apt-get, wget) then you might also need to look at Internet access not working in Windows Subsystem for Linux.

  • this has been fixed recently - some insider builds don't need to run as admin to have ping and ping6 working – Magnetic_dud Oct 27 '16 at 10:46
  • it's funny that you are already root without running as administrator, but that doesn't work – Michael Dec 26 '16 at 18:20
2

It didn't work before because as pointed out in @Silveri's answer it requires the ICMP protocol, which wasn't implemented in earlier versions.

As of build 14352, it became enabled for consoles which have administrator privileges.

As of build 14926, it became enabled for consoles which do not have administrator privileges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.