10

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?

7
  • 3
    Can you show the full command ?
    – Ofiris
    Feb 13, 2013 at 5:28
  • Are you sure the website was not returning the "permission denied" error, rather then Perl ? What variant of Linux are you using and is SELinux running ?
    – davidgo
    Feb 13, 2013 at 5:44
  • @davidgo I'm using OS X for this...
    – GiH
    Feb 13, 2013 at 15:44
  • @Ofiris sudo curl roots.cx/get | sh
    – GiH
    Feb 13, 2013 at 15:45
  • @GiH Try adding a sudo after the pipe
    – Ofiris
    Feb 13, 2013 at 17:03

2 Answers 2

7

Use sudo after the pipe:

curl roots.cx/get | sudo sh

the get script involves some installation, requires sudo to run.

2
  • Not working on OS X 10.10.3.
    – Ain
    Apr 16, 2015 at 17:25
  • @Ain in Super User, consider the popular answer to Redirect output to a file permission denied? (2013-05-15). Mar 23, 2017 at 5:16
2

Alternatively you can use:

sudo \curl roots.cx/get | sh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .