Why does sudo not work with curl?
I ran a command to download something with curl
–
sudo curl roots.cx/get | sh
– and it threw a permission denied error. So I did sudo curl
and I got the same error … why is that?
I was able to run the install command without curl
, but I needed to sudo
, so why does curl
not work with sudo
?
Solution 1:
Use sudo after the pipe:
curl roots.cx/get | sudo sh
the get script involves some installation, requires sudo to run.
Solution 2:
Alternatively you can use:
sudo \curl roots.cx/get | sh