2

I am trying to install the pipedream cli onto my pi and when I run the installer script as sudo I am getting a permission error saying it can't copy any files into /usr/local/bin/pd

  • The error I am receiving is:
    cannot move '/tmp/pd-XvV/pd' to '/usr/local/bin/pd': Permission denied
    
  • And the command I am running is:
    curl https://cli.pipedream.com/install | sh
    

If there is a way to setup permissions and their is a guide that would be useful too.

The developer of the app have this suggestion but I don't really understand what he means:

This install script tries to install the CLI to /usr/local/bin/, so you'll need write/execute permissions for that directory.

4
  • 2
    Welcome to the site. Please edit your post to include what CLI you are trying to install, what commands you used, and what exact error message you receive. Currently, the question is too unspecific to analze.
    – AdminBee
    Commented Aug 12, 2020 at 10:05
  • I have edited the message as you asked Commented Aug 12, 2020 at 13:02
  • 1
    Get a root shell with sudo -s then run your curl https://cli.pipedream.com/install | sh with root permissions.
    – Dougie
    Commented Aug 14, 2020 at 22:43
  • @Dougie thanks for the answer but we have already found an answer Commented Aug 14, 2020 at 22:51

2 Answers 2

4

I have solved my problem with help from @Peter Paul Kiefer in the last answer.

I was running this command:

sudo curl https://cli.pipedream.com/install | sh

But this was only running curl as sudo i needed to run this:

curl https://cli.pipedream.com/install | sudo sh

To run sh as sudo not curl

2
  • Please mark the answer as the accepted one. That prevents your Question from being shown as a unsolved Post to the community and saves them/us a lot of work. Thank you. Commented Aug 14, 2020 at 9:28
  • I was going to but I needed to wait 19 hours Commented Aug 14, 2020 at 13:36
0

I don't see where you use sudo.

Perhaps it helps if you try:

curl https://cli.pipedream.com/install > /tmp/sd_insta.sh && \
   sudo sh /tmp/sd_insta.sh

In your configuration: Even if you call the curl command with sudo that command pipes the output to a shell command which is not called with a sudo. And I expect the shell call will do the copy that was denied, because it has no right to write to /usr/local/bin.

EDIT

My idea was to download the installer script to a scriptfile in the temp-Folder (/tmp). To do this you don't need special rights because /tmp should be writable for everyone.

If the download succeeded (the && executes the following command only if the previous command succeeded) I execute the downloaded script in a shell that was startet with sudo.

If you perform the following ls :

ls -l /usr/local/bin

It should output something like:

drwxrwsr-x 2 root staff 4096 Nov 13  2018 bin <--------- bin folder
drwxrwsr-x 2 root staff 4096 Nov 13  2018 etc
drwxrwsr-x 2 root staff 4096 Nov 13  2018 games
drwxrwsr-x 2 root staff 4096 Nov 13  2018 include
drwxrwsr-x 4 root staff 4096 Nov 13  2018 lib
...

You see that the bin folder is flagged with `drwxrwsr-x'

That means

d: -> it's a folder/directory
rwx -> it's readable, writeable and executable for the owner ("root")
rws -> it's readable, writeable for the group ("staff") and has the setuid flag set.
r-x -> it is readable and executable but not writable for everyone.

For a folder/directory executable means that the granted subject/login-name can cdinto the folder.

The setuid flag has no meaning for this problem. Used for directories, it adds the same groupname ("staff") to every file or folder that's created in the flagged (bin) folder.

If you get the same output root should be allowed to copy the pd programm int /usr/local/bin.

And if

ls -l /usr/local/

returns something other like

dr-xrwsr-x 2 root staff 4096 Nov 13  2018 bin
...

then you probably excluded event root from writing into the folder.

In this case you can repair it with

sudo chmod 775 /usr/local/bin
sudo chmod g+s /usr/local/bin
4
  • This doesn't seem to work either but the developer of the cli said this: This install script tries to install the CLI to /usr/local/bin/, so you'll need write / execute permissions for that directory. Commented Aug 12, 2020 at 16:01
  • @user13862056 I agree with the developer. And therefor I tried to execute the shell script with sudo. That means one executes the script as user root. And root should have read, write and execution permissions for /usr/local/bin. I'll edit the answer. Commented Aug 13, 2020 at 13:30
  • I have found a solution thank you for trying to help. before you edit you mentioned about running sh as sudo, the command you stated I should run didn't work for some reason but running the sh part of the command the developer said to run did work so it should of worked. Commented Aug 13, 2020 at 14:28
  • Im glad to help you a little bit. Your final solution is a better solution than mine. It's shorter and I fear my solution didn't work for you, because it needs correct formatting. E.g. there must not be a space character after the last `` in the first line. But at the end, you did what I suggested (runnung sh with sudo). So, you unterstood the problem and found a solution by your own. It was fun to work with you. Thank you. Commented Aug 14, 2020 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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